Skip to content

Commit b0c92a7

Browse files
committed
see 03/02 log
1 parent e9e2750 commit b0c92a7

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

utilcode/src/main/java/com/blankj/utilcode/util/ObjectUtils.java

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* author: Blankj
1818
* blog : http://blankj.com
1919
* time : 2017/12/24
20-
* desc : 对象相关工具类
20+
* desc : utils about object
2121
* </pre>
2222
*/
2323
public final class ObjectUtils {
@@ -27,10 +27,10 @@ private ObjectUtils() {
2727
}
2828

2929
/**
30-
* 判断对象是否为空
30+
* Return whether object is empty.
3131
*
32-
* @param obj 对象
33-
* @return {@code true}: 为空<br>{@code false}: 不为空
32+
* @param obj The object.
33+
* @return {@code true}: yes<br>{@code false}: no
3434
*/
3535
public static boolean isEmpty(final Object obj) {
3636
if (obj == null) {
@@ -78,63 +78,64 @@ public static boolean isEmpty(final Object obj) {
7878
}
7979

8080
/**
81-
* 判断对象是否非空
81+
* Return whether object is not empty.
8282
*
83-
* @param obj 对象
84-
* @return {@code true}: 非空<br>{@code false}:
83+
* @param obj The object.
84+
* @return {@code true}: yes<br>{@code false}: no
8585
*/
8686
public static boolean isNotEmpty(final Object obj) {
8787
return !isEmpty(obj);
8888
}
8989

9090
/**
91-
* 判断对象是否相等
91+
* Return whether object1 is equals to object2.
9292
*
93-
* @param o1 对象1
94-
* @param o2 对象2
95-
* @return {@code true}: 相等<br>{@code false}: 不相等
93+
* @param o1 The first object.
94+
* @param o2 The second object.
95+
* @return {@code true}: yes<br>{@code false}: no
9696
*/
97-
public static boolean equals(Object o1, Object o2) {
97+
public static boolean equals(final Object o1, final Object o2) {
9898
return o1 == o2 || (o1 != null && o1.equals(o2));
9999
}
100100

101101
/**
102-
* 检查对象非空
102+
* Require the object is not null.
103103
*
104-
* @param object 对象
105-
* @param message 报错
106-
* @param <T> 范型
107-
* @return 非空对象
104+
* @param <T> The value type.
105+
* @param object The object.
106+
* @param message The message to use with the NullPointerException.
107+
* @return the object
108+
* @throws NullPointerException if object is null
108109
*/
109-
public static <T> T requireNonNull(T object, String message) {
110+
public static <T> T requireNonNull(final T object, final String message) {
110111
if (object == null) {
111112
throw new NullPointerException(message);
112113
}
113114
return object;
114115
}
115116

116117
/**
117-
* 获取非空或默认对象
118+
* Return the nonnull object or default object.
118119
*
119-
* @param object 对象
120-
* @param defaultObject 默认值
121-
* @param <T> 范型
122-
* @return 非空或默认对象
120+
* @param <T> The value type.
121+
* @param object The object.
122+
* @param defaultObject The default object to use with the object is null.
123+
* @return the nonnull object or default object
123124
*/
124-
public static <T> T getOrDefault(T object, T defaultObject) {
125+
public static <T> T getOrDefault(final T object, final T defaultObject) {
125126
if (object == null) {
126127
return defaultObject;
127128
}
128129
return object;
129130
}
130131

131132
/**
132-
* 获取对象哈希值
133+
* Return the hash code of object.
133134
*
134-
* @param o 对象
135-
* @return 哈希值
135+
* @param o The object.
136+
* @return the hash code of object
136137
*/
137-
public static int hashCode(Object o) {
138+
public static int hashCode(final Object o) {
138139
return o != null ? o.hashCode() : 0;
139140
}
140141
}

0 commit comments

Comments
 (0)