public class Indexer<E extends java.lang.Comparable<E>>
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected TIntMap<E> |
indexes |
protected boolean |
locked |
protected java.util.ArrayList<E> |
objects |
Constructor and Description |
---|
Indexer() |
Indexer(boolean sync) |
Indexer(java.util.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) |
java.lang.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.
|
public Indexer(boolean sync)
public Indexer()
public Indexer(java.util.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()
public java.lang.Iterable<E> getObjects()