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>
  • Method Details

    • 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 interface Copyable
      Specified by:
      copy in interface XGettingCollection<E>
      Returns:
      a copy of this list
    • 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 interface XGettingCollection<E>
      Returns:
      an immutable copy of this collection instance.
    • get

      Gets the first element in the collection. This is a parameterless alias for at(0).

      first() is an alias for this method.

      Specified by:
      get in interface XGettingCollection<E>
      Returns:
      the first element.
      Throws:
      NoSuchElementException - if collection is empty
      See Also:
      at(long), first(), last()
    • at

      E at​(long index) throws IndexBoundsException
      Throws:
      IndexBoundsException
    • hasIndex

      default boolean hasIndex​(long index)
      Equivalent to "contains index". Compare: XGettingTable table with table.keys().contains(index)
      Parameters:
      index - the index to check
      Returns:
      true 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.
    • first

      E first() throws IndexBoundsException
      Gets first element or throws IndexOutOfBoundsException if the collection is empty.

      Is an alias for get().

      Returns:
      First element
      Throws:
      IndexBoundsException
    • last

      E last() throws IndexBoundsException
      Gets last element or throws IndexOutOfBoundsException 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

      long maxIndex​(Comparator<? super E> comparator)
    • minIndex

      long minIndex​(Comparator<? super E> comparator)
    • indexOf

      long indexOf​(E element)
    • indexBy

      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.

      Basically the opposite of lastIndexBy(Predicate)

      Parameters:
      predicate - to define a valid element
      Returns:
      The index of the first positively tested element.
    • lastIndexOf

      long lastIndexOf​(E element)
    • lastIndexBy

      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.

      Basically the opposite of indexBy(Predicate).
      Similar but not the same as scan(Predicate), since scan iterates through all elements.

      Parameters:
      predicate - to define a valid element
      Returns:
      the index of the last positively tested element.
    • scan

      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").

      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)

      Parameters:
      predicate - to define a valid element
      Returns:
      the index of the last positively tested element.
    • isSorted

      boolean isSorted​(Comparator<? super E> comparator)
      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 new XGettingSequence 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

      <T extends Consumer<? super E>> T copySelection​(T target, long... indices)
      Iterates through all the elements of the given indices and calls the Consumer.accept(Object) on the target Consumer.
      Type Parameters:
      T - type of the target
      Parameters:
      target - on which the Consumer.accept(Object) is called
      indices - of the elements which are copied
      Returns:
      Given target
    • 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 interface XGettingCollection<E>
      Returns:
      new read-only collection to view this collection
    • view

      XGettingSequence<E> view​(long lowIndex, long highIndex)
      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

      XGettingSequence<E> range​(long lowIndex, long highIndex)