创建
TreeSet() // 默认构造函数。使用该构造函数,TreeSet中的元素按照自然排序进行排列
TreeSet(Collection<? extends E> collection) // 创建的TreeSet包含collection
TreeSet(Comparator<? super E> comparator) // 指定TreeSet的比较器
TreeSet(SortedSet<E> set) // 创建的TreeSet包含set
使用
增
boolean add(E object)
boolean addAll(Collection<? extends E> collection)
删
void clear()
boolean remove(Object object)
查
boolean contains(Object object)
E first()
boolean isEmpty()
E last()
E pollFirst()
E pollLast()
E lower(E e)
E floor(E e)
E ceiling(E e)
E higher(E e)
int size()
Iterator<E> iterator()
Iterator<E> descendingIterator()
SortedSet<E> headSet(E end)
NavigableSet<E> descendingSet()
NavigableSet<E> headSet(E end, boolean endInclusive)
SortedSet<E> subSet(E start, E end)
NavigableSet<E> subSet(E start, boolean startInclusive, E end, boolean endInclusive)
NavigableSet<E> tailSet(E start, boolean startInclusive)
SortedSet<E> tailSet(E start)
其他
Object clone()
Comparator<? super E> comparator()