|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.jonclark.lang.SparseArray<T>
public class SparseArray<T>
An array based on LinkedLists such that memory usage is minimized even for very large arrays Note: Array indices are constant; list indicies are subject to change. Created on January 30, 2006
| Constructor Summary | |
|---|---|
SparseArray()
|
|
| Method Summary | |
|---|---|
T |
get(long arrIndex)
Get an object at a specified array index |
boolean |
hasIndex(long arrIndex)
Determine if the specified index has already been assigned a value in this sparse array |
void |
set(long arrIndex,
T obj)
Write an object at the given array index |
long |
size()
Returns the number of elements that have been set to a non-null value |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SparseArray()
| Method Detail |
|---|
public void set(long arrIndex,
T obj)
arrIndex - The index of the object to add/replaceobj - The object to write
public T get(long arrIndex)
throws RuntimeException
arrIndex - The array index of the desired object
RuntimeExceptionpublic boolean hasIndex(long arrIndex)
arrIndex -
public long size()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||