在我來說,我有4個的ArrayList如下對象:添加多個ArrayList中對象的所有元素連接成一個ArrayList對象
ArrayList<MyProduct> lstStyle;
ArrayList<MyProduct> 2ndStyle;
ArrayList<MyProduct> 3rdStyle;
ArrayList<MyProduct> 4thStyle;
我想在每一個ArrayList的所有元素添加到一個新的的ArrayList叫做風格。
ArrayList<MyProduct> Style;
我可以做到這一點沒有循環每個ArrayList?
Collections.addAll將所有指定的元素到指定的集合。要添加的元素可以單獨指定或作爲數組指定。 – Shamse