package java.util; public interface SortedSet<E> extends Set<E> { //返回比较器 Comparator<? super E> comparator(); //视图 [fromElement,toElement) SortedSet<E> subSet(E fromElement, E toElement); //视图 [,toElement) SortedSet<E> headSet(E toElement); //视图 [fromElement,] 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(); } }; } }