Java generics, nested collection of wildcard

Well the explanations are correct, but I think it’d be a nice thing to add the actual working solution as well 😉

List<? extends List<? extends Object>>

Will work just fine, but obviously the use of such a collection is quite limited by the usual limitations of generic Collections (but then the same is true for the simpler List< ? extends Date >)

Leave a Comment