Modifier and Type Method and Description
boolean [**add**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#add-E->)([**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) e)Adds the specified element to this set if it is not already present.
boolean [**addAll**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#addAll-java.util.Collection->)([**Collection**](<https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html>)<? extends [**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>)> c)Adds all of the elements in the specified collection to this set.
E [**ceiling**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#ceiling-E->)([**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) e)Returns the least element in this set greater than or equal to the given element, or null if there is no such element.
void [**clear**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#clear-->)()Removes all of the elements from this set.
Object [**clone**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#clone-->)()Returns a shallow copy of this TreeSet instance.
[**Comparator**](<https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html>)<? super [**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>)> [**comparator**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#comparator-->)()Returns the comparator used to order the elements in this set, or null if this set uses the natural ordering of its elements.
boolean [**contains**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#contains-java.lang.Object->)([**Object**](<https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>) o)Returns true if this set contains the specified element.
[**Iterator**](<https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html>)<[**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>)> [**descendingIterator**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#descendingIterator-->)()Returns an iterator over the elements in this set in descending order.
[**NavigableSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/NavigableSet.html>)<[**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>)> [**descendingSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#descendingSet-->)()Returns a reverse order view of the elements contained in this set.
E [**first**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#first-->)()Returns the first (lowest) element currently in this set.
E [**floor**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#floor-E->)([**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) e)Returns the greatest element in this set less than or equal to the given element, or null if there is no such element.
[**SortedSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/SortedSet.html>)<[**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>)> [**headSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#headSet-E->)([**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) toElement)Returns a view of the portion of this set whose elements are strictly less than toElement.
[**NavigableSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/NavigableSet.html>)<[**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>)> [**headSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#headSet-E-boolean->)([**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) toElement, boolean inclusive)Returns a view of the portion of this set whose elements are less than (or equal to, if inclusive is true) toElement.
E [**higher**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#higher-E->)([**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) e)Returns the least element in this set strictly greater than the given element, or null if there is no such element.
boolean [**isEmpty**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#isEmpty-->)()Returns true if this set contains no elements.
[**Iterator**](<https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html>)<[**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>)> [**iterator**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#iterator-->)()Returns an iterator over the elements in this set in ascending order.
E [**last**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#last-->)()Returns the last (highest) element currently in this set.
E [**lower**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#lower-E->)([**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) e)Returns the greatest element in this set strictly less than the given element, or null if there is no such element.
E [**pollFirst**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#pollFirst-->)()Retrieves and removes the first (lowest) element, or returns null if this set is empty.
E [**pollLast**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#pollLast-->)()Retrieves and removes the last (highest) element, or returns null if this set is empty.
boolean [**remove**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#remove-java.lang.Object->)([**Object**](<https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>) o)Removes the specified element from this set if it is present.
int [**size**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#size-->)()Returns the number of elements in this set (its cardinality).
[**Spliterator**](<https://docs.oracle.com/javase/8/docs/api/java/util/Spliterator.html>)<[**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>)> [**spliterator**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#spliterator-->)()Creates a late-binding and fail-fast Spliterator over the elements in this set.
[**NavigableSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/NavigableSet.html>)<[**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>)> [**subSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#subSet-E-boolean-E-boolean->)([**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) fromElement, boolean fromInclusive, [**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) toElement, boolean toInclusive)Returns a view of the portion of this set whose elements range from fromElement to toElement.
[**SortedSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/SortedSet.html>)<[**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>)> [**subSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#subSet-E-E->)([**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) fromElement, [**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) toElement)Returns a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive.
[**SortedSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/SortedSet.html>)<[**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>)> [**tailSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#tailSet-E->)([**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) fromElement)Returns a view of the portion of this set whose elements are greater than or equal to fromElement.
[**NavigableSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/NavigableSet.html>)<[**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>)> [**tailSet**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#tailSet-E-boolean->)([**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html>) fromElement, boolean inclusive)Returns a view of the portion of this set whose elements are greater than (or equal to, if inclusive is true) fromElement.