ObjectUtil.java
773 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
38
39
40
41
42
package com.wd.common.utils;
/**
* @author LiuKun
* @date 2023/4/26 20:19
* @Description:objectUti
*/
public class ObjectUtil {
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;
}
if (hashCode(target) == hashCode(source)) {
return true;
}
return false;
}
}