Interface TreeList<E>

    • Method Detail

      • comparator

        Optional<Comparator<? super E>> comparator()
        Returns the comparator used to order the elements in this list, or an empty Optional if the elements are ordered by their natural ordering.
        Returns:
        the comparator used to order this list, or an empty Optional if natural ordering is used
      • subList

        TreeList<E> subList​(int fromIndex,
                            int toIndex)
        Returns a live view of the portion of this list whose elements range from the element at fromIndex (inclusive) to the element at toIndex (exclusive). The returned view is itself a TreeList: it is sorted, contains no duplicates, and supports the same operations as this list.

        The view is bounded by element values, not by indices. After creation, the view contains all elements e in this list such that compare(fromElement, e) <= 0 and compare(e, toElement) < 0, where fromElement and toElement are the elements at positions fromIndex and toIndex at the time the view was created.

        Structural modifications through the view (add, remove, clear) are reflected in the parent list, and vice versa. However, if the parent list is structurally modified outside the view, the view becomes invalid and subsequent operations will throw ConcurrentModificationException (fail-fast).

        Adding an element that falls outside the view's value range throws IllegalArgumentException, following the same convention as TreeMap.subMap(Object, Object).

        Specified by:
        subList in interface List<E>
        Parameters:
        fromIndex - low endpoint (inclusive) of the subList
        toIndex - high endpoint (exclusive) of the subList
        Returns:
        a view of the specified range within this list
        Throws:
        IndexOutOfBoundsException - if fromIndex < 0 or toIndex > size()
        IllegalArgumentException - if fromIndex > toIndex