public class SparseVector<T> extends Object implements IVector<T>, Serializable
IVector implementation designed for low occupancy. Note that get() from this vector is
a binary search.
This should only be used for small sets ... insertion and deletion are linear in size of set.
| Constructor and Description |
|---|
SparseVector() |
SparseVector(int initialSize,
float expansion) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
T |
get(int x) |
int |
getMaxIndex() |
IntIterator |
iterateIndices() |
Iterator<T> |
iterator() |
void |
performVerboseAction() |
void |
remove(int x) |
IntIterator |
safeIterateIndices()
This iteration _will_ cover all indices even when remove is called while the iterator is
active.
|
void |
set(int x,
T value)
TODO: this can be optimized
|
int |
size() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic SparseVector()
public SparseVector(int initialSize,
float expansion)
public T get(int x)
get in interface IVector<T>IntVector.get(int)public void set(int x,
T value)
set in interface IVector<T>IntVector.set(int, int)public void performVerboseAction()
performVerboseAction in interface IVector<T>VerboseAction.performVerboseAction()public Iterator<T> iterator()
iterator in interface Iterable<T>IntSet.intIterator()public int getMaxIndex()
throws IllegalStateException
getMaxIndex in interface IVector<T>IllegalStateExceptionpublic int size()
public IntIterator iterateIndices()
public IntIterator safeIterateIndices()
public void clear()
public void remove(int x)