mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-07 06:08:00 +08:00
Opt.ofEmptyAble支持更多类型
This commit is contained in:
parent
3fc8da755f
commit
168be856c0
@ -2,7 +2,7 @@
|
|||||||
# 🚀Changelog
|
# 🚀Changelog
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.24(2023-12-14)
|
# 5.8.24(2023-12-15)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【cache 】 Cache增加get重载,可自定义超时时间(issue#I8G0DL@Gitee)
|
* 【cache 】 Cache增加get重载,可自定义超时时间(issue#I8G0DL@Gitee)
|
||||||
@ -13,6 +13,7 @@
|
|||||||
* 【core 】 FileTypeUtil增加null判断(issue#3419@Github)
|
* 【core 】 FileTypeUtil增加null判断(issue#3419@Github)
|
||||||
* 【core 】 DateUtil.parse支持毫秒时间戳(issue#I8NMP7@Gitee)
|
* 【core 】 DateUtil.parse支持毫秒时间戳(issue#I8NMP7@Gitee)
|
||||||
* 【extra 】 优化TokenizerEngine使用IK分词器支持并发(pr#3427@Github)
|
* 【extra 】 优化TokenizerEngine使用IK分词器支持并发(pr#3427@Github)
|
||||||
|
* 【core 】 Opt.ofEmptyAble支持更多类型(issue#I8OOSY@Gitee)
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【core 】 修复LocalDateTime#parseDate未判断空问题问题(issue#I8FN7F@Gitee)
|
* 【core 】 修复LocalDateTime#parseDate未判断空问题问题(issue#I8FN7F@Gitee)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package cn.hutool.core.lang;
|
package cn.hutool.core.lang;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.lang.func.Func0;
|
import cn.hutool.core.lang.func.Func0;
|
||||||
import cn.hutool.core.lang.func.VoidFunc0;
|
import cn.hutool.core.lang.func.VoidFunc0;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -80,12 +80,12 @@ public class Opt<T> {
|
|||||||
*
|
*
|
||||||
* @param <T> 包裹里元素的类型
|
* @param <T> 包裹里元素的类型
|
||||||
* @param <R> 集合值类型
|
* @param <R> 集合值类型
|
||||||
* @param value 传入需要包裹的元素
|
* @param value 传入需要包裹的元素,支持CharSequence、Map、Iterable、Iterator、Array类型
|
||||||
* @return 一个包裹里元素可能为空的 {@code Opt}
|
* @return 一个包裹里元素可能为空的 {@code Opt}
|
||||||
* @since 5.7.17
|
* @since 5.7.17
|
||||||
*/
|
*/
|
||||||
public static <T, R extends Collection<T>> Opt<R> ofEmptyAble(R value) {
|
public static <T, R extends Collection<T>> Opt<R> ofEmptyAble(R value) {
|
||||||
return CollectionUtil.isEmpty(value) ? empty() : new Opt<>(value);
|
return ObjectUtil.isEmpty(value) ? empty() : new Opt<>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user