|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.utils.Pool<T>
public abstract class Pool<T>
A pool of objects that can be reused to avoid allocation.
Field Summary | |
---|---|
int |
max
|
Constructor Summary | |
---|---|
Pool()
Creates a pool with an initial capacity of 16 and no maximum. |
|
Pool(int initialCapacity)
Creates a pool with the specified initial capacity and no maximum. |
|
Pool(int initialCapacity,
int max)
|
Method Summary | |
---|---|
void |
clear()
Removes all free objects from this pool. |
void |
free(Array<T> objects)
Puts the specified objects in the pool. |
void |
free(T object)
Puts the specified object in the pool, making it eligible to be returned by obtain() . |
protected abstract T |
newObject()
|
T |
obtain()
Returns an object from this pool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final int max
Constructor Detail |
---|
public Pool()
public Pool(int initialCapacity)
public Pool(int initialCapacity, int max)
max
- The maximum number of free objects to store in this pool.Method Detail |
---|
protected abstract T newObject()
public T obtain()
newObject()
) or reused (previously
freed
).
public void free(T object)
obtain()
. If the pool already contains
max
free objects, the specified object is ignored.
public void free(Array<T> objects)
free(Object)
public void clear()
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |