add LazyFuncLoader

This commit is contained in:
Looly 2021-03-16 13:10:14 +08:00
parent d35dce9478
commit 3bd816471c
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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);
// 已经初始化