APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.utils

public Class Pools

extends Object
Class Inheritance
Annotations
@Deprecated
Imports
com.badlogic.gdx.Gdx, .Net.HttpRequest, com.badlogic.gdx.graphics.g2d.GlyphLayout, .GlyphLayout.GlyphRun, com.badlogic.gdx.math.Rectangle, com.badlogic.gdx.scenes.scene2d.InputEvent, .Stage.TouchFocus, com.badlogic.gdx.scenes.scene2d.actions.*, com.badlogic.gdx.scenes.scene2d.ui.Table.DebugRect, com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent, .FocusListener.FocusEvent, com.badlogic.gdx.utils.DefaultPool.PoolSupplier

Deprecated

Use PoolManager for bundling pools instead

Stores a map of Pools by type for convenient static access.
Author
Nathan Sweet

Field Summary

Modifier and TypeField and Description
public static boolean
private static final ObjectMap<Class<?>, Pool<?>>
public static boolean

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static void
free(Object object)

Frees an object from the pool.

public static void
freeAll(Array<T> objects)

Frees the specified objects from the pool.

public static void
freeAll(Array<T> objects, boolean
If true, objects don't need to be from the same pool but the pool must be looked up for each object.
samePool
)

Frees the specified objects from the pool.

public static <T> Pool<T>
get(Class<T> type, int max)

Returns a new or existing pool for the specified type, stored in a Class to Pool map.

public static <T> Pool<T>
get(Class<T> type)

Returns a new or existing pool for the specified type, stored in a Class to Pool map.

public static <T> T
obtain(Class<T> type)

Obtains an object from the pool.

public static <T> void
set(Class<T> type, Pool<T> pool)

Sets an existing pool for the specified type, stored in a Class to Pool map.

public static <T> void
set(DefaultPool.PoolSupplier<T> poolTypeSupplier, int max)

Sets an existing pool for the specified type, stored in a Class to Pool map.

public static <T> void
set(DefaultPool.PoolSupplier<T> poolTypeSupplier)

Sets an existing pool for the specified type, stored in a Class to Pool map.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

THROW_ON_REFLECTION_POOL_CREATIONback to summary
public static boolean THROW_ON_REFLECTION_POOL_CREATION
typePoolsback to summary
private static final ObjectMap<Class<?>, Pool<?>> typePools
WARN_ON_REFLECTION_POOL_CREATIONback to summary
public static boolean WARN_ON_REFLECTION_POOL_CREATION

Constructor Detail

Poolsback to summary
private Pools()

Method Detail

freeback to summary
public static void free(Object object)

Frees an object from the pool.

freeAllback to summary
public static void freeAll(Array<T> objects)

Frees the specified objects from the pool. Null objects within the array are silently ignored. Objects don't need to be from the same pool.

freeAllback to summary
public static void freeAll(Array<T> objects, boolean samePool)

Frees the specified objects from the pool. Null objects within the array are silently ignored.

Parameters
samePool:boolean

If true, objects don't need to be from the same pool but the pool must be looked up for each object.

getback to summary
public static <T> Pool<T> get(Class<T> type, int max)

Returns a new or existing pool for the specified type, stored in a Class to Pool map. Note the max size is ignored if this is not the first time this pool has been requested.

getback to summary
public static <T> Pool<T> get(Class<T> type)

Returns a new or existing pool for the specified type, stored in a Class to Pool map. The max size of the pool used is 100.

obtainback to summary
public static <T> T obtain(Class<T> type)

Obtains an object from the pool.

setback to summary
public static <T> void set(Class<T> type, Pool<T> pool)

Sets an existing pool for the specified type, stored in a Class to Pool map.

setback to summary
public static <T> void set(DefaultPool.PoolSupplier<T> poolTypeSupplier, int max)

Sets an existing pool for the specified type, stored in a Class to Pool map. Usage can use java 8 method references: Pools.set(MyClass::new, max)

setback to summary
public static <T> void set(DefaultPool.PoolSupplier<T> poolTypeSupplier)

Sets an existing pool for the specified type, stored in a Class to Pool map. Usage can use java 8 method references: Pools.set(MyClass::new)