I have an array that is initialized like:
Element[] array = {new Element(1), new Element(2), new Element(3)};
I would like to convert this
Since this question is pretty old, it surprises me that nobody suggested the simplest form yet:
List arraylist = Arrays.asList(new Element(1), new Element(2), new Element(3));
As of Java 5, Arrays.asList() takes a varargs parameter and you don't have to construct the array explicitly.
Arrays.asList()