Package icyllis.modernui.util
Class Pools.SimplePool<T>
java.lang.Object
icyllis.modernui.util.Pools.SimplePool<T>
- Type Parameters:
T
- The pooled type.
- All Implemented Interfaces:
Pools.Pool<T>
- Direct Known Subclasses:
Pools.SynchronizedPool
- Enclosing class:
Pools
Simple (non-synchronized) pool of objects.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
SimplePool
public SimplePool(int maxPoolSize) Creates a new instance.- Parameters:
maxPoolSize
- The max pool size.- Throws:
IllegalArgumentException
- If the max pool size is less than zero.
-
-
Method Details
-
acquire
- Specified by:
acquire
in interfacePools.Pool<T>
- Returns:
- An instance from the pool if such, null otherwise.
-
release
Description copied from interface:Pools.Pool
Release an instance to the pool.- Specified by:
release
in interfacePools.Pool<T>
- Parameters:
instance
- The instance to release.- Returns:
- Whether the instance was put in the pool.
-