Computer Science, asked by Poe1996, 6 months ago

for (int i = 0; i < idList.size(); i++) {
System.out.println(i + " " + idList.get(i));
}
this is the correct answer.

Answers

Answered by Anonymous
1

Answer:

public class ArrayListImpl{

public static void main(String s[]){

ArrayList<Integer> al1=new ArrayList<Integer>();

al1.add(21);al1.add(23);al1.add(25);al1.add(26);

ArrayList<Integer> al2=new ArrayList<Integer>();

al2.add(15);al2.add(16);al2.add(23);al2.add(25);

ArrayList Al3=new ArrayList<Integer>();

al3.addAll(al1);

System.out.println("Al3 Elements :"+al3);

al3.retainAll(al2); //Keeps common elements of (al1 & al2) & removes remaining elements

System.out.println("Common Elements Between Two Array List:"+al3);

}

}

Similar questions