对象池
This commit is contained in:
parent
e70225cea5
commit
c0b896c4fe
|
@ -7,7 +7,7 @@ import java.util.function.Consumer;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 对象池(防止频繁创建对象触发GC,必须继承)
|
||||
* 对象池(防止频繁创建对象触发GC)
|
||||
* @param <T> 对象类型
|
||||
* @author spyn
|
||||
*/
|
||||
|
@ -58,6 +58,7 @@ public class ObjectPool<T> implements Iterable<T> {
|
|||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
// 重置对象
|
||||
reset.accept(object);
|
||||
this.pool.push(object);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue