To create an ArrayList from an array

Asked 2 years ago, Updated 2 years ago, 148 views

I will

    Element[] array = {new Element(1), new Element(2), new Element(3)};

I initialized this arrangement

    ArrayList<Element> arraylist = ???;

How do I put it in here?

java array arraylist

2022-09-22 22:38

1 Answers

new ArrayList(Arrays.asList(array)) You can do it like this.


2022-09-22 22:38

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.