public final class SimplePool
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
current
index of previous to next
free slot
|
private int |
max
max amount of objects to be managed
set via CTOR
|
private java.lang.Object[] |
pool |
Constructor and Description |
---|
SimplePool(int max) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
get()
Get an object from the pool, null if the pool is empty.
|
int |
getMax()
Return the size of the pool
|
(package private) java.lang.Object[] |
getPool()
for testing purposes, so we can examine the pool
|
void |
put(java.lang.Object o)
Add the object to the pool, silent nothing if the pool is full
|
private java.lang.Object[] pool
private int max
private int current
public void put(java.lang.Object o)
o
- public java.lang.Object get()
public int getMax()
java.lang.Object[] getPool()