Inside my Mappable
List class, I have a = Integer
list and I want to add int
inside this list.
Usually list.add(int)
will work because of java's auto boxing but I am wondering why this doesn't work for me here.
Code explain: During construction of the MappableList
I can pass in variable number of int parameters and I want to add them all to the Integer list
public class MappableList<Integer>{
private final List<Integer> list;
public MappableList(int... numbers){
list = new ArrayList<Integer>();
for(int i : numbers){
list.add(4);
}
}
}
list.add(4);
make any sense according to your desired behaviour? – Tom Feb 23 '17 at 10:26