2013-11-26 45 views

回答

3

使用List#addAll(Collection c)方法

Style.addAll(lstStyle); 
Style.addAll(2ndStyle); 
Style.addAll(3rdStyle); 
Style.addAll(4thStyle); 

Ofcourse,你需要先實例的所有名單,否則你會面臨NullPointerException

0

使用addAll方法

ArrayList<MyProduct> Style; 

Style.addAll(lstStyle); 
Style.addAll(2ndStyle); 
Style.addAll(3rdStyle); 
Style.addAll(4thStyle); 
3
Collections.addAll(Style, lstStyle, 2ndStyle, 3rdStyle, 34thStyle); 
+0

Collections.addAll將所有指定的元素到指定的集合。要添加的元素可以單獨指定或作爲數組指定。 – Shamse

相關問題