In JavaScript I can build an Array of string values like:
var stuff = new Array('foo','bar','baz','boz','gaz','goz');
or even easier
var stuff = 'foo,bar,baz,boz,gaz,goz'.split(',');
In Java it seems overly verbose and complex... is there an easier way than this?
ArrayList<String> stuff = new ArrayList<String>();
stuff.add("foo");
stuff.add("bar");
stuff.add("baz");
stuff.add("boz");
stuff.add("gaz");
stuff.add("goz");
In my actual scenario I have 30-40 items going into the ArrayList... I figure there just has to be an easier way! What is the obvious bit I'm overlooking?