-
Notifications
You must be signed in to change notification settings - Fork 0
/
CheckArrayList.java
42 lines (34 loc) · 1.18 KB
/
CheckArrayList.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class CheckArrayList {
public boolean print(List<Integer> list1, List<Integer> list2, List<Integer> list3) {
boolean flag = false;
if (list1.equals(list2)) {
System.out.println("l1==l2");
flag = true;
} else {
System.out.println("l1!=l2");
}
if (list2.equals(list3)) {
System.out.println("l2==l3");
flag = true;
} else {
System.out.println("l2!=l3");
}
if (list3.equals(list1)) {
System.out.println("l3==l1");
flag = true;
} else {
System.out.println("l3!=l1");
}
return flag;
}
public static void main(String[] args) {
ArrayList<Integer> list1 = new ArrayList<>(List.of(1, 4, 5, 7, 2));
ArrayList<Integer> list3 = new ArrayList<>(Arrays.asList(1, 4, 5, 7, 5));
List<Integer> list2 = new ArrayList<>(List.of(1, 4, 5, 7, 2));
CheckArrayList checkArrayList = new CheckArrayList();
System.out.println("Check Condition : " + checkArrayList.print(list1, list2, list3));
}
}