// Create the lists
List samplelist1 = new ArrayList();
List samplelist2 = new ArrayList();
samplelist1.add("A");
samplelist2.add("B");
// Copy all the elements from samplelist2 to samplelist1 (samplelist1=samplelist1+samplelist2)
samplelist1.addAll(samplelist2); // samplelist1=["A","B"]
// Remove all the elements in samplelist1 from samplelist2 (samplelist1=samplelist1-samplelist2)
samplelist1.removeAll(samplelist2); // samplelist1=["A"]
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment