Create ArrayList from array
@lebyy▲ 0 net votes
Problem: Element[] array = {new Element(1), new Element(2), new Element(3)}; How do I convert the above variable of type Element[] into a variable of type ArrayList<Element> ? ArrayList<Element> arrayList = ...; Fix (from the top answer): You can use the following instruction: new ArrayList<>(Arrays.asList(array));