public class SparseArray extends Object implements Iterable<SparseArray.Entry>
| Modifier and Type | Class and Description |
|---|---|
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.
|
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 Iterator<SparseArray.Entry> iterator()
iterator in interface 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.Copyright © 2015. All rights reserved.