ObjectTools.java
699 Bytes
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
package com.wd.capability.layout.uitls;
/**
* Author LiuKun
* date:2023/3/21
* desc:
*/
public class ObjectTools {
public static boolean isNull(Object obj) {
return obj == null;
}
public static boolean isNotNull(Object obj) {
return obj != null;
}
public static int hashCode(Object obj) {
return obj.hashCode();
}
public static boolean equals(Object source, Object target) {
if (isNull(source)) {
return false;
}
if (isNull(target)) {
return false;
}
if (target == source) {
return true;
}
return hashCode(target) == hashCode(source);
}
}