List of usage examples for com.badlogic.gdx.utils Array Array
public Array(boolean ordered, int capacity, Class arrayType)
From source file:com.badlydrawngames.general.Pools.java
License:Apache License
/** Creates an array from a pool, freeing its items if it already exists. * @param <T> the type of item allocated in the array. * @param array the array of items to (re)create. * @param pool the pool that the items are to be allocated from / released to. * @param size the array's capacity./*from ww w .jav a 2s .c o m*/ * @return the input array */ @SuppressWarnings("unchecked") public static <T> Array<T> makeArrayFromPool(Array<T> array, Pool<T> pool, int size) { if (array == null) { // Do this so that array.items can be used. T t = pool.obtain(); array = new Array<T>(false, size, (Class<T>) t.getClass()); pool.free(t); } else { freeArrayToPool(array, pool); } return array; }