Package net.dermetfan.gdx.utils
Class ArrayPool<T>
java.lang.Object
net.dermetfan.gdx.utils.ArrayPool<T>
- Direct Known Subclasses:
ReflectionArrayPool
pools arrays by their size
- Since:
- 0.11.1
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
max
public final int maxthe maximum amount of arrays of different lengths that will be pooled -
maxEach
public final int maxEachthe maximum amount of arrays of the same length that will be pooled
-
-
Constructor Details
-
ArrayPool
public ArrayPool(int max, int maxEach)
-
-
Method Details
-
newArray
- Returns:
- a new array of the given length
-
obtain
- Parameters:
length- the desired length of the array
-
free
- Parameters:
array- the array to put back into the pool
-
clear
public void clear() -
getFree
public int getFree(int length) - Returns:
- the number of arrays of the given length in the pool
-