1import java.util.*;
2public class ComapreArraylistExample1
3{
4 public static void main(String args[])
5 {
6 //first array list
7 ArrayList<String> firstList=new ArrayList<String>();
8 //adds elements to the arraylist
9 firstList.add("Apple");
10 firstList.add("Pears");
11 firstList.add("Guava");
12 firstList.add("Mango");
13 //second array list
14 List<String> secondList=new ArrayList<String>();
15 //adds elements to the arraylist
16 secondList.add("Apple");
17 secondList.add("Pears");
18 secondList.add("Guava");
19 secondList.add("Mango");
20 //comparing both lists
21 boolean boolval = firstList.equals(secondList);
22 //returns true because lists are equal
23 }
24}