compareTo java elements in an arraylist code example
Example: compare to arraylist java
import java.util.*;
public class ComapreArraylistExample1
{
public static void main(String args[])
{
ArrayList<String> firstList=new ArrayList<String>();
firstList.add("Apple");
firstList.add("Pears");
firstList.add("Guava");
firstList.add("Mango");
List<String> secondList=new ArrayList<String>();
secondList.add("Apple");
secondList.add("Pears");
secondList.add("Guava");
secondList.add("Mango");
boolean boolval = firstList.equals(secondList);
}
}