mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
add LazyFuncLoader
This commit is contained in:
parent
d35dce9478
commit
3bd816471c
@ -3,11 +3,12 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 5.6.1 (2021-03-14)
|
||||
# 5.6.1 (2021-03-16)
|
||||
|
||||
### 新特性
|
||||
* 【crypto 】 SecureUtil去除final修饰符(issue#1474@Github)
|
||||
* 【core 】 IoUtil增加lineIter方法
|
||||
* 【core 】 新增函数式懒加载加载器(pr#275@Gitee)
|
||||
|
||||
### Bug修复
|
||||
* 【core 】 修复IoUtil.readBytes的FileInputStream中isClose参数失效问题(issue#I3B7UD@Gitee)
|
||||
|
@ -14,8 +14,10 @@ import java.util.function.Supplier;
|
||||
* @param <T> 被加载对象类型
|
||||
* @author Mr.Po
|
||||
* @see cn.hutool.core.lang.loader.LazyLoader
|
||||
* @since 5.6.1
|
||||
*/
|
||||
public final class LazyFunLoader<T> extends LazyLoader<T> {
|
||||
public class LazyFunLoader<T> extends LazyLoader<T> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用于生成对象的函数
|
||||
@ -34,10 +36,8 @@ public final class LazyFunLoader<T> extends LazyLoader<T> {
|
||||
|
||||
@Override
|
||||
protected T init() {
|
||||
|
||||
T t = this.supplier.get();
|
||||
this.supplier = null;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
@ -56,7 +56,6 @@ public final class LazyFunLoader<T> extends LazyLoader<T> {
|
||||
* @param consumer 待执行函数
|
||||
*/
|
||||
public void ifInitialized(Consumer<T> consumer) {
|
||||
|
||||
Assert.notNull(consumer);
|
||||
|
||||
// 已经初始化
|
||||
|
Loading…
x
Reference in New Issue
Block a user