Sobes.tech
Junior — Senior

Comparison of lists with wildcard types: extends, super, and specific type

livecode

Task condition

It is necessary to understand the differences between collections declared using wildcard types.

  • How do upList, downList, and exactList differ?
  • What elements can be added to each of these collections?
  • What elements can be retrieved from each collection?
class A {}
class B extends A {}
class C extends B {}
List<? extends B> upList = ...
List<? super B> downList = ...
List<B> exactList = ...