Back
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 array into an object of the ArrayList class.
ArrayList<Element> arraylist = ???;
Just use:
new ArrayList<>(Arrays.asList(array))
30.9k questions
32.9k answers
500 comments
665 users