Package icyllis.modernui.util
Class Pools
java.lang.Object
icyllis.modernui.util.Pools
Helper class for creating pools of objects.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface for managing a pool of objects.static classSimple (non-synchronized) pool of objects.static classSynchronized pool of objects. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Pools.Pool<T> newSimplePool(int maxPoolSize) Creates a simple (non-synchronized) pool of objects.static <T> Pools.Pool<T> newSynchronizedPool(int maxPoolSize) Creates a synchronized pool of objects.static <T> Pools.Pool<T> newSynchronizedPool(int maxPoolSize, Object lock) Creates a synchronized pool of objects.
-
Method Details
-
newSimplePool
Creates a simple (non-synchronized) pool of objects.- Parameters:
maxPoolSize- The max pool size.- Throws:
IllegalArgumentException- If the max pool size is less than zero.
-
newSynchronizedPool
Creates a synchronized pool of objects.- Parameters:
maxPoolSize- The max pool size.- Throws:
IllegalArgumentException- If the max pool size is less than zero.
-
newSynchronizedPool
Creates a synchronized pool of objects.- Parameters:
maxPoolSize- The max pool size.- Throws:
IllegalArgumentException- If the max pool size is less than zero.
-