Package com.badlogic.gdx.utils
Class Pools
- java.lang.Object
-
- com.badlogic.gdx.utils.Pools
-
public class Pools extends java.lang.ObjectStores a map ofPools (usuallyReflectionPools) by type for convenient static access.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidfree(java.lang.Object object)Frees an object from thepool.static voidfreeAll(Array objects)Frees the specified objects from thepool.static voidfreeAll(Array objects, boolean samePool)Frees the specified objects from thepool.static <T> Pool<T>get(java.lang.Class<T> type)Returns a new or existing pool for the specified type, stored in a Class toPoolmap.static <T> Pool<T>get(java.lang.Class<T> type, int max)Returns a new or existing pool for the specified type, stored in a Class toPoolmap.static <T> Tobtain(java.lang.Class<T> type)Obtains an object from thepool.static <T> voidset(java.lang.Class<T> type, Pool<T> pool)Sets an existing pool for the specified type, stored in a Class toPoolmap.
-
-
-
Method Detail
-
get
public static <T> Pool<T> get(java.lang.Class<T> type, int max)
Returns a new or existing pool for the specified type, stored in a Class toPoolmap. Note the max size is ignored if this is not the first time this pool has been requested.
-
get
public static <T> Pool<T> get(java.lang.Class<T> type)
Returns a new or existing pool for the specified type, stored in a Class toPoolmap. The max size of the pool used is 100.
-
set
public static <T> void set(java.lang.Class<T> type, Pool<T> pool)Sets an existing pool for the specified type, stored in a Class toPoolmap.
-
obtain
public static <T> T obtain(java.lang.Class<T> type)
Obtains an object from thepool.
-
free
public static void free(java.lang.Object object)
Frees an object from thepool.
-
freeAll
public static void freeAll(Array objects)
Frees the specified objects from thepool. Null objects within the array are silently ignored. Objects don't need to be from the same pool.
-
-