Interface XSortableSequence<E>

All Superinterfaces:
CapacityCarrying, Copyable, ExtendedCollection<E>, ExtendedSequence<E>, Iterable<E>, Sized, Sortable<E>, XGettingCollection<E>, XGettingSequence<E>, XIndexIterable<E>, XIterable<E>, XJoinable<E>, XOrderingSequence<E>
All Known Subinterfaces:
XBasicTable.Values<K,​V>, XChart.Values<K,​V>, XDecreasingEnum<E>, XDecreasingList<E>, XDecreasingSequence<E>, XEnum<E>, XIncreasingEnum<E>, XIncreasingList<E>, XIncreasingSequence<E>, XList<E>, XReference<E>, XSequence<E>, XSettingEnum<E>, XSettingList<E>, XSettingSequence<E>, XSortableEnum<E>, XTable<K,​V>, XTable.Keys<K,​V>, XTable.Values<K,​V>
All Known Implementing Classes:
ArrayAccessor, ArrayCollector, BulkList, EqBulkList, EqHashEnum, EqHashTable, EqHashTable.Keys, EqHashTable.Values, FixedList, HashEnum, HashTable, HashTable.Keys, HashTable.Values, LimitList, LinkReference.Default, ListAccessor, LockedList, Single, Singleton, SubList, SubListAccessor, SubListProcessor, SynchList

public interface XSortableSequence<E>
extends XGettingSequence<E>, Sortable<E>, XOrderingSequence<E>
  • Method Details

    • shiftTo

      XSortableSequence<E> shiftTo​(long sourceIndex, long targetIndex)
      Description copied from interface: XOrderingSequence
      Moves the element from the sourceIndex in the sequence to the targetIndex.
      All other elements are possibly moved to create the empty slot for the shifting element.

      Does not expand or shrink the capacity of the sequence.

      Throws a IndexExceededException if sourceIndex or targetIndex are greater than the size of the sequence.

      Specified by:
      shiftTo in interface XOrderingSequence<E>
      Parameters:
      sourceIndex - points to the source element; Index of the source element
      targetIndex - points to the target element; Index of the target element
      Returns:
      this
    • shiftTo

      XSortableSequence<E> shiftTo​(long sourceIndex, long targetIndex, long length)
      Description copied from interface: XOrderingSequence
      Moves multiple elements from the sourceIndex in the sequence to the targetIndex.
      All other elements are possibly moved to create the empty slot for the shifting element.

      Does not expand or shrink the capacity of the sequence.

      Throws a IndexExceededException if sourceIndex or targetIndex exceed the size of the sequence.

      Specified by:
      shiftTo in interface XOrderingSequence<E>
      Parameters:
      sourceIndex - points to the source element; Index of the source element
      targetIndex - points to the target element; Index of the target element
      length - Amount of moved elements.
      Returns:
      self
    • shiftBy

      XSortableSequence<E> shiftBy​(long sourceIndex, long distance)
      Description copied from interface: XOrderingSequence
      Moves the element from the sourceIndex in the sequence to a higher index position.
      All other elements are possibly moved to create the empty slot for the shifting element. ("to the right")

      Does not expand or shrink the capacity of the sequence.

      Throws a IndexExceededException if sourceIndex or targetIndex (sourceIndex+distance) exceed the size of the sequence.

      Specified by:
      shiftBy in interface XOrderingSequence<E>
      Parameters:
      sourceIndex - points to the source element; Index of the source element
      distance - of how far the element should be moved. Example: 1 moves the element from position 21 to position 22
      Returns:
      self
    • shiftBy

      XSortableSequence<E> shiftBy​(long sourceIndex, long distance, long length)
      Description copied from interface: XOrderingSequence
      Moves multiple elements from the sourceIndex in the sequence to a higher index position.
      All other elements are possibly moved to create the empty slot for the shifting elements. ("to the right")

      Does not expand or shrink the capacity of the sequence.

      Throws a IndexExceededException if sourceIndex or targetIndex (sourceIndex+distance+length) exceed the size of the sequence.

      Specified by:
      shiftBy in interface XOrderingSequence<E>
      Parameters:
      sourceIndex - points to the source element; Index of the source element
      distance - of how far the element should be moved. Example: 1 moves the element from position 21 to position 22
      length - Amount of moved elements.
      Returns:
      self
    • swap

      XSortableSequence<E> swap​(long indexA, long indexB)
      Specified by:
      swap in interface XOrderingSequence<E>
    • swap

      XSortableSequence<E> swap​(long indexA, long indexB, long length)
      Specified by:
      swap in interface XOrderingSequence<E>
    • reverse

      XSortableSequence<E> reverse()
      Reverses the order of its own elements and returns itself.

      Unlike the toReversed() method, this method does not create a new collection, but changes the order of its own elements.

      Specified by:
      reverse in interface XOrderingSequence<E>
      Returns:
      this
    • sort

      XSortableSequence<E> sort​(Comparator<? super E> comparator)
      Description copied from interface: Sortable
      Sorts this collection according to the given comparator and returns itself.
      Specified by:
      sort in interface Sortable<E>
      Parameters:
      comparator - to sort this collection
      Returns:
      this
    • copy

      Description copied from interface: XGettingSequence
      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>
      Specified by:
      copy in interface XGettingSequence<E>
      Returns:
      a copy of this list
    • toReversed

      XSortableSequence<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.

      Unlike the reverse() method, this method creates a new collection and does not change the existing collection.

      Specified by:
      toReversed in interface XGettingSequence<E>
      Returns:
      New copy of the collection