2016-03-25 8 views
-2

私はその初心者の質問を知っています。同じクラスの2つのリストがあります。私はprogramaticly list1からlist2に項目を追加する方法Androidコピーリストをお互いに

List<A> list1 = new List<A>(); 
List<A> list2 = new List<A>(); 

list2に1つ1つずつ追加する必要があります。

+1

リストはabsractです。それを開始することはできません –

+0

下記の私の答えを見てください –

答えて

0
You can do like this NOT LIST USING ANY CHILD CLASS LIKE ARRYLIST. 

List<Your class name> list1 = new ArrayList(); 
List<Your class name> list2 = new ArrayList(); 
// populate lists here 

list1.addAll(list2) // will add all items of list2 in list 1 
0
List<Model> arrList1 = new ArrayList(); 
List<Model> arrList2 = new ArrayList(arrList1); // it will copy all records of arrList1 to arrList2. 

はあなたのためにそれは便利願っています。

関連する問題