public interface LongArray<V> extends Cloneable, Serializable, Iterable<V>
Unlike the List interface, the LongArray interface assumes that every index can be accessed and has storage available.
Modifier and Type | Interface and Description |
---|---|
static interface |
LongArray.Iterator<V>
An Iterator that adds a "current element" concept, similar to the
Map.Entry interface. |
Modifier and Type | Field and Description |
---|---|
static long |
NOT_FOUND
This index is used to indicate that an element was not found.
|
Modifier and Type | Method and Description |
---|---|
long |
add(V oValue)
Add the passed element value to the LongArray and return the index at
which the element value was stored.
|
V |
ceiling(long lIndex)
Return the "first" value with an index which is greater than or equal to the specified index.
|
long |
ceilingIndex(long lIndex)
Return the "first" index which is greater than or equal to the specified index.
|
void |
clear()
Remove all nodes from the LongArray.
|
LongArray<V> |
clone()
Make a clone of the LongArray.
|
boolean |
contains(V oValue)
Determine if the LongArray contains the specified element.
|
boolean |
equals(Object o)
Test for LongArray equality.
|
boolean |
exists(long lIndex)
Determine if the specified index is in use.
|
V |
floor(long lIndex)
Return the "first" value with an index which is less than or equal to the specified index.
|
long |
floorIndex(long lIndex)
Return the "first" index which is less than or equal to the specified index.
|
V |
get(long lIndex)
Return the value stored at the specified index.
|
long |
getFirstIndex()
Determine the first index that exists in the LongArray.
|
long |
getLastIndex()
Determine the last index that exists in the LongArray.
|
int |
getSize()
Determine the size of the LongArray.
|
long |
indexOf(V oValue)
Return the index in this LongArray of the first occurrence of
the specified element, or NOT_FOUND if this LongArray does not
contain the specified element.
|
long |
indexOf(V oValue,
long lIndex)
Return the index in this LongArray of the first occurrence of
the specified element such that (index greater or equal to lIndex), or
NOT_FOUND if this LongArray does not contain the specified element.
|
boolean |
isEmpty()
Test for empty LongArray.
|
LongArray.Iterator<V> |
iterator()
Obtain a LongArray.Iterator of the contents of the LongArray in
order of increasing indices.
|
LongArray.Iterator<V> |
iterator(long lIndex)
Obtain a LongArray.Iterator of the contents of the LongArray in
order of increasing indices, starting at a particular index such
that the first call to next will set the location of
the iterator at the first existent index that is greater than or
equal to the specified index, or will throw a
NoSuchElementException if there is no such existent index.
|
default long[] |
keys()
Return an array of the indices into this LongArray.
|
long |
lastIndexOf(V oValue)
Return the index in this LongArray of the last occurrence of the
specified element, or NOT_FOUND if this LongArray does not
contain the specified element.
|
long |
lastIndexOf(V oValue,
long lIndex)
Return the index in this LongArray of the last occurrence of
the specified element such that (index less then or equal to lIndex), or
NOT_FOUND if this LongArray does not contain the specified element.
|
V |
remove(long lIndex)
Remove the specified index from the LongArray, returning its associated
value.
|
void |
remove(long lIndexFrom,
long lIndexTo)
Remove all nodes in the specified range.
|
LongArray.Iterator<V> |
reverseIterator()
Obtain a LongArray.Iterator of the contents of the LongArray in
reverse order (decreasing indices).
|
LongArray.Iterator<V> |
reverseIterator(long lIndex)
Obtain a LongArray.Iterator of the contents of the LongArray in
reverse order (decreasing indices), starting at a particular
index such that the first call to next will set the
location of the iterator at the first existent index that is
less than or equal to the specified index, or will throw a
NoSuchElementException if there is no such existent index.
|
V |
set(long lIndex,
V oValue)
Add the passed item to the LongArray at the specified index.
|
String |
toString()
Provide a string representation of the LongArray.
|
forEach, spliterator
static final long NOT_FOUND
V get(long lIndex)
lIndex
- a long index valuelong floorIndex(long lIndex)
lIndex
- the indexV floor(long lIndex)
lIndex
- the indexlong ceilingIndex(long lIndex)
lIndex
- the indexV ceiling(long lIndex)
lIndex
- the indexV set(long lIndex, V oValue)
If the index is already used, the passed value will replace the current value stored with the key, and the replaced value will be returned.
It is expected that LongArray implementations will "grow" as necessary to support the specified index.
lIndex
- a long index valueoValue
- the object to store at the specified indexlong add(V oValue)
oValue
- the object to add to the LongArrayboolean exists(long lIndex)
lIndex
- a long index valueV remove(long lIndex)
lIndex
- the index into the LongArrayvoid remove(long lIndexFrom, long lIndexTo)
lIndexFrom
- the floor indexlIndexTo
- the ceiling index (exclusive)boolean contains(V oValue)
More formally, returns true if and only if this LongArray contains at least one element e such that (o==null ? e==null : o.equals(e)).
oValue
- element whose presence in this list is to be testedvoid clear()
boolean isEmpty()
int getSize()
LongArray.Iterator<V> iterator()
LongArray.Iterator<V> iterator(long lIndex)
lIndex
- the LongArray index to iterate fromLongArray.Iterator<V> reverseIterator()
LongArray.Iterator<V> reverseIterator(long lIndex)
lIndex
- the LongArray index to iterate fromlong getFirstIndex()
long getLastIndex()
long indexOf(V oValue)
oValue
- the object to find index forlong indexOf(V oValue, long lIndex)
oValue
- the object to find the index forlIndex
- the index to compare tolong lastIndexOf(V oValue)
oValue
- the object to find the index forlong lastIndexOf(V oValue, long lIndex)
oValue
- the object to find the index forlIndex
- the index to compare todefault long[] keys()
String toString()
boolean equals(Object o)