0 votes
1 view
in Java by (3.5k points)

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 = ???;

1 Answer

0 votes
by (46.1k points)

Just use:

new ArrayList<>(Arrays.asList(array))

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
+1 vote
2 answers
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...