我有一个像这样初始化的数组:

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

我想将此数组转换为ArrayList类的对象。

ArrayList<Element> arraylist = ???;


解决方案:
new ArrayList<>(Arrays.asList(array));
 
 

我有一个像这样初始化的数组:

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

我想将此数组转换为ArrayList类的对象。

ArrayList<Element> arraylist = ???;


解决方案:
new ArrayList<>(Arrays.asList(array));


我有一个像这样初始化的数组:

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

我想将此数组转换为ArrayList类的对象。

ArrayList<Element> arraylist = ???;


解决方案:
new ArrayList<>(Arrays.asList(array));




我有一个像这样初始化的数组:

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

我想将此数组转换为ArrayList类的对象。

ArrayList<Element> arraylist = ???;


解决方案:
new ArrayList<>(Arrays.asList(array));



我有一个像这样初始化的数组:

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

我想将此数组转换为ArrayList类的对象。

ArrayList<Element> arraylist = ???;


解决方案:
new ArrayList<>(Arrays.asList(array));