public interface LongList extends LongSizedIterable
Modifier and Type | Interface and Description |
---|---|
static class |
LongList.Single |
Modifier and Type | Method and Description |
---|---|
int |
binarySearch(long value)
Performs binary search.
|
int |
binarySearch(long value,
int from,
int to)
Performs binary search on list slice.
|
boolean |
contains(long value)
Checks whether collection contains specified value
|
long |
get(int index) |
LongList |
get(IntList indices)
Creates and returns a list which is this list indexed by
indices Analogy: get(index) returns one value from this list, get(indices) returns a list with multiple values from this list. |
int |
getNextDifferentValueIndex(int curIndex)
For a given index i, returns minimum index j, for which exactly one of the following holds:
j = -1 and for all k > i, a[k] = a[i] ;
j > i and a[i] != a[j] ,
where a represents the list. |
int |
indexOf(long value) |
boolean |
isEmpty()
Checks whether collection is empty.
|
boolean |
isSorted() |
boolean |
isSortedUnique() |
LongListIterator |
iterator() |
LongListIterator |
iterator(int from) |
LongListIterator |
iterator(int from,
int to) |
int |
size()
Size of the collection.
|
LongList |
subList(int from,
int to)
Returns a sub-list, backed by this list.
|
java.util.List<java.lang.Long> |
toList() |
long[] |
toNativeArray()
Creates new native array and stores values there.
|
long[] |
toNativeArray(int startIndex,
long[] dest,
int destOffset,
int length)
Writes values to dest.
|
static final LongList EMPTY
int size()
size
in interface LongSizedIterable
boolean isEmpty()
boolean contains(long value)
value
- value to checklong get(int index) throws java.util.NoSuchElementException
java.util.NoSuchElementException
LongList get(IntList indices)
indices
[get(indices.get(0)), get(indices.get(1)), .., get(indices.get(indices.size() - 1))]
LongIndexedIterator
and LongListIndexedIterator
can be used
to iterate over this list via a custom set of indices.indices
in this listLongIndexedIterator
,
LongListIndexedIterator
int indexOf(long value)
long[] toNativeArray()
Note: effectively written code should avoid use this method.
long[] toNativeArray(int startIndex, long[] dest, int destOffset, int length)
LongList subList(int from, int to)
NB: If values are removed from the parent list, this may result in OOBE when accessing sublist.
from
- starting index, inclusiveto
- ending index, exclusiveint binarySearch(long value)
int binarySearch(long value, int from, int to)
boolean isSorted()
boolean isSortedUnique()
@NotNull LongListIterator iterator()
iterator
in interface java.lang.Iterable<LongIterator>
iterator
in interface LongIterable
@NotNull LongListIterator iterator(int from)
@NotNull LongListIterator iterator(int from, int to)
int getNextDifferentValueIndex(int curIndex)
j = -1 and for all k > i, a[k] = a[i]
;j > i and a[i] != a[j]
,a
represents the list.size()
if all values starting from the specified index are the same.java.util.List<java.lang.Long> toList()