How can I add to List<? extends Number> data structures?
Posted
by kunjaan
on Stack Overflow
See other posts from Stack Overflow
or by kunjaan
Published on 2010-05-05T21:38:00Z
Indexed on
2010/05/07
19:38 UTC
Read the original article
Hit count: 114
I have a List which is declared like this :
List<? extends Number> foo3 = new ArrayList<Integer>();
I tried to add 3 to foo3. However I get an error message like this:
The method add(capture#1-of ? extends Number) in the type List<capture#1-of ?
extends Number> is not applicable for the arguments (ExtendsNumber)
© Stack Overflow or respective owner