public interface XGettingSequence<E> extends XGettingCollection<E>, ExtendedSequence<E>, XIndexIterable<E>
| Modifier and Type | Interface and Description |
|---|---|
static interface |
XGettingSequence.Factory<E> |
XGettingCollection.Creator<E>Copyable.StaticXIterable.Executor<E>| Modifier and Type | Method and Description |
|---|---|
E |
at(long index) |
XGettingSequence<E> |
copy()
Creates a true copy of this list which references the same elements in the same order as this list does
at the time the method is called.
|
<T extends Consumer<? super E>> |
copySelection(T target,
long... indices)
Iterates through all the elements of the given indices and calls the
Consumer.accept(Object) on the target Consumer. |
E |
first()
Gets first element or throws
IndexOutOfBoundsException if the collection is empty. |
E |
get()
Gets the first element in the collection.
|
default boolean |
hasIndex(long index)
Equivalent to "contains index".
|
XImmutableSequence<E> |
immure()
Provides an instance of an immutable collection type with equal behavior and data as this instance.
|
long |
indexBy(Predicate<? super E> predicate)
Iterates forwards through the collection and returns the index of the first element that the passed {link Predicate}
applies to immediately.
Stops iterating on the first element that the predicate applies to. |
long |
indexOf(E element) |
boolean |
isSorted(Comparator<? super E> comparator)
Tests if the collection is sorted according to the given comparator.
|
E |
last()
Gets last element or throws
IndexOutOfBoundsException if the collection is empty. |
long |
lastIndexBy(Predicate<? super E> predicate)
Iterates backwards through the collection and returns the index of the last element that the passed
Predicate
applies to immediately.Stops iterating on the first element that the predicate applies to. |
long |
lastIndexOf(E element) |
long |
maxIndex(Comparator<? super E> comparator) |
long |
minIndex(Comparator<? super E> comparator) |
E |
peek()
Gets last element or null if the collection is empty.
|
E |
poll()
Gets first element or null if the collection is empty.
|
XGettingSequence<E> |
range(long lowIndex,
long highIndex) |
long |
scan(Predicate<? super E> predicate)
Iterates through the collection and returns the index of the last element that the passed
Predicate
applied to ("scanning"). |
XGettingSequence<E> |
toReversed()
Creates a new
XGettingSequence with the reversed order of elements. |
XGettingSequence<E> |
view()
Creates a view of this collection and returns it.
|
XGettingSequence<E> |
view(long lowIndex,
long highIndex)
Creates a sub-view of this collection and returns it.
|
applies, contains, containsAll, containsId, containsSearched, copyTo, count, countBy, distinct, distinct, equality, equals, equals, equalsContent, except, filterTo, hashCode, hasVolatileElements, intersect, intSize, iterator, join, max, min, nullContained, old, search, seek, size, toArray, toArray, unionforEach, spliteratorisFull, maximumCapacity, remainingCapacitynullAllowediterateIndexedXGettingSequence<E> copy()
copy in interface Copyablecopy in interface XGettingCollection<E>XImmutableSequence<E> immure()
XGettingCollectionIf this instance already is of an immutable collection type, it returns itself.
immure in interface XGettingCollection<E>E get() throws NoSuchElementException
at(0).
first() is an alias for this method.
get in interface XGettingCollection<E>NoSuchElementException - if collection is emptyat(long),
first(),
last()E at(long index) throws IndexBoundsException
IndexBoundsExceptiondefault boolean hasIndex(long index)
XGettingTable table with table.keys().contains(index)index - the index to checktrue if the passed index is greater or equal to 0,
XGettingCollection.size() is greater than the passed index
and at(long) returns a non-null value.E first() throws IndexBoundsException
IndexOutOfBoundsException if the collection is empty.
Is an alias for get().
IndexBoundsExceptionE last() throws IndexBoundsException
IndexOutOfBoundsException if the collection is empty.IndexBoundsExceptionE poll()
E peek()
long maxIndex(Comparator<? super E> comparator)
long minIndex(Comparator<? super E> comparator)
long indexOf(E element)
long indexBy(Predicate<? super E> predicate)
Basically the opposite of lastIndexBy(Predicate)
predicate - to define a valid elementlong lastIndexOf(E element)
long lastIndexBy(Predicate<? super E> predicate)
Predicate
applies to immediately.
Basically the opposite of indexBy(Predicate).
Similar but not the same as scan(Predicate), since scan iterates through all elements.
predicate - to define a valid elementlong scan(Predicate<? super E> predicate)
Predicate
applied to ("scanning").
In order to find the last element, this method must iterate over all elements of the collection
(opposed to indexBy(Predicate) and lastIndexBy(Predicate)).
Iteration can be safely canceled with a ThrowBreak (X.BREAK)
predicate - to define a valid elementboolean isSorted(Comparator<? super E> comparator)
comparator - defines if elements are sortedXGettingSequence<E> toReversed()
XGettingSequence with the reversed order of elements.
This method creates a new collection and does not change the existing collection.
<T extends Consumer<? super E>> T copySelection(T target, long... indices)
Consumer.accept(Object) on the target Consumer.T - type of the targettarget - on which the Consumer.accept(Object) is calledindices - of the elements which are copiedXGettingSequence<E> view()
XGettingCollection
A view is different from immutable collection (XGettingCollection.immure())
in the way, that changes in this collection are still affecting the view.
The immutable collection on the other hand has no reference to this collection
and changes therefore do not affect the immutable collection.
view in interface XGettingCollection<E>XGettingSequence<E> view(long lowIndex, long highIndex)
A view is different from immutable collection (XGettingCollection.immure())
in the way, that changes in this collection are still affecting the view.
The immutable collection on the other hand has no reference to this collection
and changes therefore do not affect the immutable collection.
lowIndex - defines lower boundary for the view of the collection.highIndex - defines higher boundary for the view of the collection.XGettingSequence<E> range(long lowIndex, long highIndex)
Copyright © 2022 MicroStream Software. All rights reserved.