public class Indexer<E extends Comparable<E>> extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected TIntMap<E> |
indexes |
protected boolean |
locked |
protected ArrayList<E> |
objects |
Constructor and Description |
---|
Indexer() |
Indexer(boolean sync) |
Indexer(Collection<? extends E> c) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E elem) |
int |
getIndex(E e)
Return the index of the element If doesn't exist, add it.
|
E |
getObject(int index) |
Iterable<E> |
getObjects() |
int |
indexOf(E o)
Returns the index of the given object, or -1 if the object is not present
in the indexer.
|
void |
lock() |
int |
size()
Returns the number of objects indexed.
|
void |
trim()
Save some space my compacting underlying maps and lists.
|
protected ArrayList<E extends Comparable<E>> objects
protected TIntMap<E extends Comparable<E>> indexes
protected boolean locked
public Indexer(boolean sync)
public Indexer()
public Indexer(Collection<? extends E> c)
public void lock()
public E getObject(int index)
public boolean add(E elem)
public int size()
public int indexOf(E o)
o
- public int getIndex(E e)
public void trim()