Wildcard (Java): Difference between revisions

Content deleted Content added
RippleSax (talk | contribs)
RippleSax (talk | contribs)
Line 56:
In the Java Collections Framework, the class <code>List<MyClass></code> represents an ordered collection of objects of type <code>MyClass</code>.
Upper bounds are specified using <code>extends</code>:
A <code>List<? extends MyClass></code> is a list of objects of some subclass of <code>MyClass</code>, i.e. any object in the list is guaranteed to be of type <code>MyClass</code>, so one can iterate over it using a variable of type <code>MyClass</code><ref>[[Inheritance (object-oriented programming)]]</ref>
<source lang="java5">
public void doSomething(List<? extends MyClass> list) {