Interface XSortableEnum<E>

All Superinterfaces:
CapacityCarrying, Copyable, ExtendedCollection<E>, ExtendedSequence<E>, Iterable<E>, Sized, Sortable<E>, XGettingCollection<E>, XGettingEnum<E>, XGettingSequence<E>, XGettingSet<E>, XIndexIterable<E>, XIterable<E>, XJoinable<E>, XOrderingEnum<E>, XOrderingSequence<E>, XSortableSequence<E>
All Known Subinterfaces:
XDecreasingEnum<E>, XEnum<E>, XIncreasingEnum<E>, XReference<E>, XSettingEnum<E>, XTable<K,​V>, XTable.Keys<K,​V>
All Known Implementing Classes:
EqHashEnum, EqHashTable, EqHashTable.Keys, HashEnum, HashTable, HashTable.Keys, LinkReference.Default, Single, Singleton

public interface XSortableEnum<E>
extends XSortableSequence<E>, XGettingEnum<E>, XOrderingEnum<E>
  • Method Details

    • shiftTo

      XSortableEnum<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 XOrderingEnum<E>
      Specified by:
      shiftTo in interface XOrderingSequence<E>
      Specified by:
      shiftTo in interface XSortableSequence<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

      XSortableEnum<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 XOrderingEnum<E>
      Specified by:
      shiftTo in interface XOrderingSequence<E>
      Specified by:
      shiftTo in interface XSortableSequence<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

      XSortableEnum<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 XOrderingEnum<E>
      Specified by:
      shiftBy in interface XOrderingSequence<E>
      Specified by:
      shiftBy in interface XSortableSequence<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

      XSortableEnum<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 XOrderingEnum<E>
      Specified by:
      shiftBy in interface XOrderingSequence<E>
      Specified by:
      shiftBy in interface XSortableSequence<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

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

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

      XSortableEnum<E> reverse()
      Description copied from interface: XSortableSequence
      Reverses the order of its own elements and returns itself.

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

      Specified by:
      reverse in interface XOrderingEnum<E>
      Specified by:
      reverse in interface XOrderingSequence<E>
      Specified by:
      reverse in interface XSortableSequence<E>
      Returns:
      this
    • copy

      XSortableEnum<E> 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 XGettingEnum<E>
      Specified by:
      copy in interface XGettingSequence<E>
      Specified by:
      copy in interface XGettingSet<E>
      Specified by:
      copy in interface XSortableSequence<E>
      Returns:
      a copy of this list
    • toReversed

      XSortableEnum<E> toReversed()
      Description copied from interface: XSortableSequence
      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 XSortableSequence.reverse() method, this method creates a new collection and does not change the existing collection.

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

      XSortableEnum<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>
      Specified by:
      sort in interface XSortableSequence<E>
      Parameters:
      comparator - to sort this collection
      Returns:
      this