ArrayList initialization equivalent to array initialization [duplicate]

I am aware that you can initialize an array during instantiation as follows:

String[] names = new String[] {"Ryan", "Julie", "Bob"};

Is there a way to do the same thing with an ArrayList? Or must I add the contents individually with array.add()?

8 Answers
8

Leave a Comment