public class SparseArray extends java.lang.Object implements java.lang.Iterable<SparseArray.Entry>, java.io.Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
SparseArray.Entry
The entry in a sparse array of double values.
|
| Constructor and Description |
|---|
SparseArray()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(int i,
double x)
Append an entry to the array, optimizing for the case where the index is greater than all existing indices in the array.
|
double |
get(int i)
Returns the value of i-th entry.
|
boolean |
isEmpty()
Returns true if the array is empty.
|
java.util.Iterator<SparseArray.Entry> |
iterator()
Returns an iterator of nonzero entries.
|
void |
remove(int i)
Removes an entry.
|
boolean |
set(int i,
double x)
Sets or add an entry.
|
int |
size()
Returns the number of nonzero entries.
|
public int size()
public boolean isEmpty()
public java.util.Iterator<SparseArray.Entry> iterator()
iterator in interface java.lang.Iterable<SparseArray.Entry>public double get(int i)
i - the index of entry.public boolean set(int i,
double x)
i - the index of entry.x - the value of entry.public void append(int i,
double x)
i - the index of entry.x - the value of entry.public void remove(int i)
i - the index of entry.