public class ArrayPool<T> extends Object
| Constructor and Description |
|---|
ArrayPool(Class componentType)
Creates object pool.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
cleanCurrentThread() |
static <T> ArrayPool<T> |
get(Class cls)
Returns per-thread array pool for given type, or create one if it doesn't exist.
|
T |
getAtLeast(int length)
Returns array that has same or greater length, or create one if not present
in the pool.
|
T |
getFixed(int length)
Returns array of exactly the same length as demanded, or create one if not
present in the pool.
|
void |
release(T array)
Releases array into object pool.
|
public ArrayPool(Class componentType)
componentType - public T getFixed(int length)
length - public T getAtLeast(int length)
length - the minimum length requiredpublic void release(T array)
array - previously obtained array from this poolpublic static <T> ArrayPool<T> get(Class cls)
cls - typepublic static void cleanCurrentThread()