Declare and initialize an ArrayList in one line?

Posted by Skogen on Stack Overflow See other posts from Stack Overflow or by Skogen
Published on 2010-05-08T00:56:26Z Indexed on 2010/05/08 0:58 UTC
Read the original article Hit count: 210

Filed under:
|

You can declare and initialize an array with integers in one line as following:

int[] myArray = new int[{...}];

How can I do this with an ArrayList, if possible?

© Stack Overflow or respective owner

Related posts about java

Related posts about arraylist