Interface SortedList<E>

  • Type Parameters:
    E - the type of elements in this list
    All Superinterfaces:
    java.util.Collection<E>, java.lang.Iterable<E>, java.util.List<E>
    All Known Implementing Classes:
    RestrictedValueSortedMap.RestrictedSortedList, TreeValueSortedMap.ValueSortedTreeMapValues

    public interface SortedList<E>
    extends java.util.List<E>
    An interface for sorted lists

    This might be better described as a NavigableMultiset; however, I wish for the elements to be retrievable by index, though insertion and mutation is not permitted by index. This implies that though unordered, the underlying implementation has sorted the elements in some way and wishes to expose that ordering to its clients.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int ceilingIndex​(E element)
      Returns the least index in this list whose element is greater than or equal to the specified element
      int floorIndex​(E element)
      Returns the greatest index in this list whose element is less than or equal to the specified element
      int higherIndex​(E element)
      Returns the least index in this list whose element is strictly greater the specified element
      int lowerIndex​(E element)
      Returns the greatest index in this list whose element is strictly less than the specified element
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
    • Method Detail

      • lowerIndex

        int lowerIndex​(E element)
        Returns the greatest index in this list whose element is strictly less than the specified element
        Parameters:
        element - the element to search for
        Returns:
        the index of the found element, or -1
      • floorIndex

        int floorIndex​(E element)
        Returns the greatest index in this list whose element is less than or equal to the specified element

        If multiples of the specified element exist, this returns the least index of that element.

        Parameters:
        element - the element to search for
        Returns:
        the index of the found element, or -1
      • ceilingIndex

        int ceilingIndex​(E element)
        Returns the least index in this list whose element is greater than or equal to the specified element

        If multiples of the specified element exist, this returns the greatest index of that element.

        Parameters:
        element - the element to search for
        Returns:
        the index of the found element, or -1
      • higherIndex

        int higherIndex​(E element)
        Returns the least index in this list whose element is strictly greater the specified element
        Parameters:
        element - the element to search for
        Returns:
        the index of the found element, or -1