How to set arrayList size as null?

Posted by Jessy on Stack Overflow See other posts from Stack Overflow or by Jessy
Published on 2010-04-01T01:52:32Z Indexed on 2010/04/01 2:03 UTC
Read the original article Hit count: 458

Filed under:
|
|
String a []= {null,null,null,null,null};

//add array to arraylist
ArrayList<Object> choice = new ArrayList<Object>(Arrays.asList(a)); 

System.out.println(choice.size());

Why the size of the arrayList choice is 5 when all the elements have been set to null

© Stack Overflow or respective owner

Related posts about java

Related posts about arraylist