Interface XGettingSequence<E>
- All Superinterfaces:
CapacityCarrying
,Copyable
,ExtendedCollection<E>
,ExtendedSequence<E>
,Iterable<E>
,Sized
,XGettingCollection<E>
,XIndexIterable<E>
,XIterable<E>
,XJoinable<E>
- All Known Subinterfaces:
XBasicEnum<E>
,XBasicList<E>
,XBasicSequence<E>
,XBasicTable<K,V>
,XBasicTable.Keys<K,V>
,XBasicTable.Values<K,V>
,XChart<K,V>
,XChart.Keys<K,V>
,XChart.Values<K,V>
,XDecreasingEnum<E>
,XDecreasingList<E>
,XDecreasingSequence<E>
,XEnum<E>
,XGettingEnum<E>
,XGettingList<E>
,XGettingSortation<E>
,XGettingTable<K,V>
,XGettingTable.Keys<K,V>
,XGettingTable.Values<K,V>
,XImmutableEnum<E>
,XImmutableEnum.Factory<E>
,XImmutableList<E>
,XImmutableSequence<E>
,XImmutableTable<K,V>
,XImmutableTable.Keys<K,V>
,XImmutableTable.Values<K,V>
,XIncreasingEnum<E>
,XIncreasingList<E>
,XIncreasingSequence<E>
,XLadder<E>
,XList<E>
,XProcessingEnum<E>
,XProcessingList<E>
,XProcessingSequence<E>
,XProcessingSortation<E>
,XPutGetEnum<E>
,XPutGetList<E>
,XPutGetSequence<E>
,XPutGetSortation<E>
,XRank<E>
,XReference<E>
,XReferencing<E>
,XSequence<E>
,XSettingEnum<E>
,XSettingList<E>
,XSettingSequence<E>
,XSortableEnum<E>
,XSortableSequence<E>
,XSortation<E>
,XTable<K,V>
,XTable.Keys<K,V>
,XTable.Values<K,V>
- All Known Implementing Classes:
ArrayAccessor
,ArrayCollector
,ArrayView
,BulkList
,Constant
,ConstHashEnum
,ConstHashTable
,ConstHashTable.Keys
,ConstHashTable.Values
,ConstLinearEnum
,ConstList
,Empty
,EmptyTable
,EnumProcessor
,EnumView
,EqBulkList
,EqConstHashEnum
,EqConstHashTable
,EqConstHashTable.Keys
,EqConstHashTable.Values
,EqConstList
,EqHashEnum
,EqHashTable
,EqHashTable.Keys
,EqHashTable.Values
,FixedList
,HashEnum
,HashTable
,HashTable.Keys
,HashTable.Values
,LimitList
,LinkingReferencing.Default
,LinkReference.Default
,ListAccessor
,ListProcessor
,ListView
,LockedList
,MappedList
,Single
,Singleton
,SingletonView
,SubCollector
,SubList
,SubListAccessor
,SubListProcessor
,SubListView
,SubProcessor
,SubView
,SynchList
,TableView
public interface XGettingSequence<E> extends XGettingCollection<E>, ExtendedSequence<E>, XIndexIterable<E>
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
XGettingSequence.Factory<E>
Nested classes/interfaces inherited from interface one.microstream.collections.interfaces.ExtendedCollection
ExtendedCollection.Creator<E,C extends ExtendedCollection<E>>
Nested classes/interfaces inherited from interface one.microstream.collections.types.XGettingCollection
XGettingCollection.Creator<E>
Nested classes/interfaces inherited from interface one.microstream.collections.types.XIterable
XIterable.Executor<E>
-
Method Summary
Modifier and Type Method 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>>
TcopySelection(T target, long... indices)
Iterates through all the elements of the given indices and calls theConsumer.accept(Object)
on the targetConsumer
.E
first()
Gets first element or throwsIndexOutOfBoundsException
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 throwsIndexOutOfBoundsException
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 passedPredicate
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 passedPredicate
applied to ("scanning").XGettingSequence<E>
toReversed()
Creates a newXGettingSequence
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.Methods inherited from interface one.microstream.collections.interfaces.CapacityCarrying
isFull, maximumCapacity, remainingCapacity
Methods inherited from interface one.microstream.collections.interfaces.ExtendedCollection
nullAllowed
Methods inherited from interface one.microstream.collections.types.XGettingCollection
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, union
-
Method Details
-
copy
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. The elements themselves are NOT copied (no deep copying).
The type of the returned list is the same as of this list if possible (i.e.: a SubList can not meaningful return a true copy that references its elements but still is a SubList)- Specified by:
copy
in interfaceCopyable
- Specified by:
copy
in interfaceXGettingCollection<E>
- Returns:
- a copy of this list
-
immure
XImmutableSequence<E> immure()Description copied from interface:XGettingCollection
Provides an instance of an immutable collection type with equal behavior and data as this instance.If this instance already is of an immutable collection type, it returns itself.
- Specified by:
immure
in interfaceXGettingCollection<E>
- Returns:
- an immutable copy of this collection instance.
-
get
Gets the first element in the collection. This is a parameterless alias forat(0)
.first()
is an alias for this method.- Specified by:
get
in interfaceXGettingCollection<E>
- Returns:
- the first element.
- Throws:
NoSuchElementException
- if collection is empty- See Also:
at(long)
,first()
,last()
-
at
- Throws:
IndexBoundsException
-
hasIndex
default boolean hasIndex(long index)Equivalent to "contains index". Compare:XGettingTable
table with table.keys().contains(index)- Parameters:
index
-- Returns:
- true if the passed index is greater or equal to 0,
XGettingCollection.size()
is greater than the passed index andat(long)
returns a non-null value.
-
first
Gets first element or throwsIndexOutOfBoundsException
if the collection is empty.Is an alias for
get()
.- Returns:
- First element
- Throws:
IndexBoundsException
-
last
Gets last element or throwsIndexOutOfBoundsException
if the collection is empty.- Returns:
- Last element
- Throws:
IndexBoundsException
-
poll
E poll()Gets first element or null if the collection is empty.- Returns:
- First element or null
-
peek
E peek()Gets last element or null if the collection is empty.
This behaves like peeking on a stack without pop.- Returns:
- Last element or null
-
maxIndex
-
minIndex
-
indexOf
-
indexBy
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.Basically the opposite of
lastIndexBy(Predicate)
- Parameters:
predicate
- to define a valid element- Returns:
- The index of the first positively tested element.
-
lastIndexOf
-
lastIndexBy
Iterates backwards through the collection and returns the index of the last element that the passedPredicate
applies to immediately.
Stops iterating on the first element that the predicate applies to.Basically the opposite of
indexBy(Predicate)
.
Similar but not the same asscan(Predicate)
, sincescan
iterates through all elements.- Parameters:
predicate
- to define a valid element- Returns:
- the index of the last positively tested element.
-
scan
Iterates through the collection and returns the index of the last element that the passedPredicate
applied to ("scanning").In order to find the last element, this method must iterate over all elements of the collection (opposed to
indexBy(Predicate)
andlastIndexBy(Predicate)
).Iteration can be safely canceled with a
ThrowBreak
(X.BREAK
)- Parameters:
predicate
- to define a valid element- Returns:
- the index of the last positively tested element.
-
isSorted
Tests if the collection is sorted according to the given comparator.- Parameters:
comparator
- defines if elements are sorted- Returns:
- true if it sorted, false if not
-
toReversed
XGettingSequence<E> toReversed()Creates a newXGettingSequence
with the reversed order of elements.This method creates a new collection and does not change the existing collection.
- Returns:
- New copy of the collection
-
copySelection
Iterates through all the elements of the given indices and calls theConsumer.accept(Object)
on the targetConsumer
.- Type Parameters:
T
- type of the target- Parameters:
target
- on which theConsumer.accept(Object)
is calledindices
- of the elements which are copied- Returns:
- Given target
-
view
XGettingSequence<E> view()Description copied from interface:XGettingCollection
Creates a view of this collection and returns it. It is a read-only collection, which wraps around this collection and only allows read methods.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.- Specified by:
view
in interfaceXGettingCollection<E>
- Returns:
- new read-only collection to view this collection
-
view
Creates a sub-view of this collection and returns it. It is a read-only collection, which wraps around this collection and only allows read methods.
The view is limited to a range from the lowIndex to the 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.- Parameters:
lowIndex
- defines lower boundary for the view of the collection.highIndex
- defines higher boundary for the view of the collection.- Returns:
- new read-only collection to view a range of elements in this collection
-
range
-