Issue
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 = ...;
Solution
You can use the following instruction:
new ArrayList<>(Arrays.asList(array));
Answered By - Tom
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.