List<?>
does mean list of object of unknown type, it's not the same as List<Object>
.
Because we don't know the type of elements in the list result of i.get(0)
is considered by Java as Object
, and you cannot add Object
to List<?>
. In case as your Java could be smarter, but in more complex code with <?>
wildcards it's easy to make it no type safe.