This site requires JavaScript, please enable it in your browser!
Greenfoot back
Duta
Duta wrote ...

2012/2/12

Lists

Duta Duta

2012/2/12

#
java.util.List<Integer> aList = java.util.Collections.<Integer>emptyList();
aList.add(1);
throws the error: java.lang.UnsupportedOperationException at java.util.AbstractList.add(AbstractList.java:131) at java.util.AbstractList.add(AbstractList.java:91) ???
kiarocks kiarocks

2012/2/12

#
You shold import java.util.* and put
List<Integer> aList = new ArrayList<Integer>;  
aList.add(1); 
Duta Duta

2012/2/12

#
Yeah I know about the java.util.* import, I was just including the classes full names for clarity. But thanks :D
You need to login to post a reply.