SortedSet接口

public interface SortedSet<E> extends Set<E> {

    Comparator<? super E> comparator();


    SortedSet<E> subSet(E fromElement, E toElement);


    SortedSet<E> headSet(E toElement);


    SortedSet<E> tailSet(E fromElement);


    E first();


    E last();


    @Override
    default Spliterator<E> spliterator() {
        return new Spliterators.IteratorSpliterator<E>(
                this, Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED) {
            @Override
            public Comparator<? super E> getComparator() {
                return SortedSet.this.comparator();
            }
        };
    }
}

猜你喜欢

转载自blog.csdn.net/Elison_zlj/article/details/81483536