对象池

This commit is contained in:
石皮幼鸟 2024-04-08 23:15:02 +08:00
parent c0b896c4fe
commit b8e4f9509b
1 changed files with 8 additions and 1 deletions

View File

@ -72,6 +72,7 @@ public class ObjectPool<T> implements Iterable<T> {
/**
* 覆写迭代器便于遍历对象池
* @return 迭代器
*/
@NotNull
@Override
@ -79,8 +80,14 @@ public class ObjectPool<T> implements Iterable<T> {
return this.pool.iterator();
}
/**
* 覆写toString方法便于输出对象池信息
* @return 对象池信息
*/
@Override
public String toString() {
return this.pool.toString();
return "ObjectPool{" +
"pool=" + pool +
"} Count: " + pool.size();
}
}