public final class TreeSequence<V> extends AbstractSparseSequence<V> implements Cloneable
Constructor and Description |
---|
TreeSequence()
Constructs an empty tree sequence.
|
Modifier and Type | Method and Description |
---|---|
IndexedEntry<V> |
ceil(int index)
Returns the entry whose index is the ceiling of the given index in this sequence.
|
void |
clear()
Removes all entries from this sequences.
|
TreeSequence<V> |
clone()
Returns a copy of this sparse sequence.
|
boolean |
containsIndex(int index)
Returns true if this sparse sequence has an entry for the
given index; otherwise returns false.
|
IndexedEntry<V> |
first()
Returns the first element in this sequence, if any.
|
IndexedEntry<V> |
floor(int index)
Returns the entry whose index is the floor of the given index in this sequence.
|
V |
get(int index)
Returns the value to which this sequence maps the given
index.
|
Iterator<IndexedEntry<V>> |
iterator(int from,
int to)
Returns an iterator over the entries in this sequence,
whose indeces are between from and to.
|
IndexedEntry<V> |
last()
Returns the last element in this sequence, if any.
|
V |
put(int index,
V value)
Throws an UnsupportedOperationException.
|
V |
remove(int index)
Removes the entry with the given index, if it exists, and
returns the value previously stored at the index.
|
int |
size()
Returns the number of entries in this sequence.
|
contains, equals, hashCode, indices, isEmpty, iterator, putAll, toString, values
forEach, spliterator
public TreeSequence()
no this.entries'
public IndexedEntry<V> ceil(int index)
ceil
in interface SparseSequence<V>
ceil
in class AbstractSparseSequence<V>
SparseSequence.ceil(int)
public void clear()
clear
in interface SparseSequence<V>
clear
in class AbstractSparseSequence<V>
no this.entries'
SparseSequence.clear()
public TreeSequence<V> clone()
clone
in interface SparseSequence<V>
clone
in class AbstractSparseSequence<V>
SparseSequence.clone()
public boolean containsIndex(int index)
containsIndex
in interface SparseSequence<V>
containsIndex
in class AbstractSparseSequence<V>
SparseSequence.containsIndex(int)
public IndexedEntry<V> first()
first
in interface SparseSequence<V>
first
in class AbstractSparseSequence<V>
SparseSequence.first()
public IndexedEntry<V> floor(int index)
floor
in interface SparseSequence<V>
floor
in class AbstractSparseSequence<V>
SparseSequence.floor(int)
public V get(int index)
get
in interface SparseSequence<V>
SparseSequence.get(int)
public Iterator<IndexedEntry<V>> iterator(int from, int to)
iterator
in interface SparseSequence<V>
SparseSequence.iterator(int, int)
public IndexedEntry<V> last()
last
in interface SparseSequence<V>
last
in class AbstractSparseSequence<V>
SparseSequence.last()
public V put(int index, V value)
put
in interface SparseSequence<V>
put
in class AbstractSparseSequence<V>
this.entries' = this.entries + index->value
SparseSequence.put(int, Object)
public V remove(int index)
remove
in interface SparseSequence<V>
remove
in class AbstractSparseSequence<V>
this.entries' = this.entries - index->E
SparseSequence.remove(int)
public int size()
size
in interface SparseSequence<V>
SparseSequence.size()
© Emina Torlak 2005-present