-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEqualsANDDeepEquals.java
More file actions
38 lines (26 loc) · 1.1 KB
/
EqualsANDDeepEquals.java
File metadata and controls
38 lines (26 loc) · 1.1 KB
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
import java.util.Arrays;
import java.util.Objects;
import static java.lang.System.gc;
import static java.lang.System.setOut;
public class EqualsANDDeepEquals {
public static void main(String[] args) {
long start = System.nanoTime();
Integer[] a = {1, 2};
Integer[] b = {1, 2};
Integer[] c = null;
System.out.println(Arrays.deepEquals(a, b)); // true
System.out.println(Objects.deepEquals(a, b)); // true
System.out.println(Objects.isNull(a)); // false
System.out.println(Objects.isNull(b)); // false
System.out.println(Objects.isNull(c)); // true
System.out.println(Objects.nonNull(c)); // false
System.out.println(Objects.nonNull(a)); // true
System.out.println(Objects.toString(a));
System.out.println(Objects.toString(a, "null 입니다."));
System.out.println(Objects.toString(c, "null 입니다."));
System.out.println(c);
long end = System.nanoTime();
System.out.println((end-start)+ " 소요됨");
System.out.println(System.getProperty("os.name"));
}
}