Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
import java.util.ArrayList;
public class ColTest{
public static void main(String args[]){
String one = new String("1");
String two = new String("2");
ArrayList ar1 = new ArrayList();
ar1.add(one);
ar1.add(two);
ArrayList ar2 = new ArrayList();
ar2.add(two);
ar2.add(one);
int matchCount = 0;
for (int i=0; i<ar1.size(); i++){
if ( ar2.contains(ar1.get(i)) ){
matchCount++;
}
}
System.out.println("matchCount"+matchCount);
if (matchCount==ar1.size()){
System.out.println("All elements are found in Arraylist 2");
}
}
}
if(list1==list2)