mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:20:07 +08:00
change code for ObjectUtil.isNotNull
This commit is contained in:
parent
231e0cf1d7
commit
d9601cbbf5
@ -3,13 +3,14 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 5.8.4.M1 (2022-06-16)
|
||||
# 5.8.4.M1 (2022-06-18)
|
||||
|
||||
### 🐣新特性
|
||||
* 【extra 】 Sftp增加构造重载,支持超时(pr#653@Gitee)
|
||||
* 【core 】 BeanUtil增加isCommonFieldsEqual(pr#653@Gitee)
|
||||
* 【json 】 修改byte[]统一转换为数组形式(issue#2377@Github)
|
||||
* 【http 】 HttpResponse增加body方法,支持自定义返回内容(pr#655@Gitee)
|
||||
* 【core 】 修改ObjectUtil.isNull逻辑(issue#I5COJF@Gitee)
|
||||
*
|
||||
### 🐞Bug修复
|
||||
* 【extra 】 修复createExtractor中抛出异常后流未关闭问题(pr#2384@Github)
|
||||
|
@ -211,12 +211,17 @@ public class ObjectUtil {
|
||||
|
||||
/**
|
||||
* 检查对象是否不为null
|
||||
* <pre>
|
||||
* 1. != null
|
||||
* 2. not equals(null)
|
||||
* </pre>
|
||||
*
|
||||
* @param obj 对象
|
||||
* @return 是否为null
|
||||
* @return 是否为非null
|
||||
*/
|
||||
public static boolean isNotNull(Object obj) {
|
||||
return false == isNull(obj);
|
||||
//noinspection ConstantConditions
|
||||
return null != obj && false == obj.equals(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -621,8 +626,8 @@ public class ObjectUtil {
|
||||
*
|
||||
* @param objs 被检查对象
|
||||
* @return 是否存在
|
||||
* @since 5.5.3
|
||||
* @see ArrayUtil#hasNull(Object[])
|
||||
* @since 5.5.3
|
||||
*/
|
||||
public static boolean hasNull(Object... objs) {
|
||||
return ArrayUtil.hasNull(objs);
|
||||
|
@ -93,4 +93,10 @@ public class ObjectUtilTest {
|
||||
final boolean basicType = ObjectUtil.isBasicType(a);
|
||||
Assert.assertTrue(basicType);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isNotNullTest(){
|
||||
String a = null;
|
||||
Assert.assertFalse(ObjectUtil.isNotNull(a));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user