public final class ObjectPool<T>
extends java.lang.Object
*Note* This pool is *NOT* thread safe
| Constructor and Description |
|---|
ObjectPool(int size,
java.util.function.Supplier<T> supplier)
This ObjectPool can be long lasting and holds a reference to the supplier function
so new instances can be created during use when the pool is empty.
|
| Modifier and Type | Method and Description |
|---|---|
T |
borrow() |
void |
giveBack(T borrowedObject) |
public ObjectPool(int size,
java.util.function.Supplier<T> supplier)
size - the size of the poolsupplier - function to create new instances