Add an Array to an ArrayList in Java
No personal offense to the people at Sun, but this has to be one of the most awkward things to do in Java that should not be awkward. You could go about it by looping through the array and adding each element. But this could be expensive if you have a large array or at least verbose if you have to do it repeatedly.
Here’s how you can do it in Java 1.5:
ArrayList col = new ArrayList(); String[] more = new String[] {"D", "E", "F", "G"}; Collections.addAll(col, more);
Not sure why they couldn’t just create a constructor that does this code under the covers. Or at least add an instance method to the ArrayList class.
This post explains more details, including a different approach is you are using Java 1.4: http://forums.sun.com/thread.jspa?messageID=3524913