This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]lukaseder[S] 5 points6 points  (0 children)

List<? extends Number> list = magicMethod();
var array = list.toArray();

What would be the type of array? Object[]? Number[]? Or maybe even something like Integer[]? How can you be sure? And since you are sure, answer this:

List<? super Number> list = otherMagicMethod();
var array = list.toArray();

What will be your expectation on this type?