1

Let’s say I define a collection of parametrized types like this:

Deque<Node<Integer>> nodes = new LinkedList<>();

nodes.add(new Node(5));

Why is it an error to pass that reference to a method with an unbounded wildcard in the signature like this:

static void printNodes(Collection<Node<?>> nodes) {...} 
Node1895
  • 11
  • 2

0 Answers0