Example usage for Java java.util TreeSet fields, constructors, methods, implement or subclass
The text is from its open source code.
TreeSet() Constructs a new, empty tree set, sorted according to the natural ordering of its elements. | |
TreeSet(NavigableMap Constructs a set backed by the specified navigable map. | |
TreeSet(Comparator super E> comparator) Constructs a new, empty tree set, sorted according to the specified comparator. | |
TreeSet(Collection extends E> c) Constructs a new tree set containing the elements in the specified collection, sorted according to the natural ordering of its elements. | |
TreeSet(SortedSet Constructs a new tree set containing the same elements and using the same ordering as the specified sorted set. |
boolean | add(E e) Adds the specified element to this set if it is not already present. |
boolean | addAll(Collection extends E> c) Adds all of the elements in the specified collection to this set. |
E | ceiling(E e) |
void | clear() Removes all of the elements from this set. |
Object | clone() Returns a shallow copy of this TreeSet instance. |
Comparator super E> | comparator() |
boolean | contains(Object o) Returns true if this set contains the specified element. |
boolean | containsAll(Collection> c) Returns true if this set contains all of the elements of the specified collection. |
Iterator | descendingIterator() Returns an iterator over the elements in this set in descending order. |
NavigableSet | descendingSet() |
boolean | equals(Object o) Compares the specified object with this set for equality. |
E | first() |
E | floor(E e) |
void | forEach(Consumer super T> action) Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception. |
SortedSet | headSet(E toElement) |
E | higher(E e) |
boolean | isEmpty() Returns true if this set contains no elements. |
Iterator | iterator() Returns an iterator over the elements in this set in ascending order. |
E | last() |
E | lower(E e) |
E | pollFirst() |
E | pollLast() |
boolean | remove(Object o) Removes the specified element from this set if it is present. |
boolean | removeAll(Collection> c) Removes from this set all of its elements that are contained in the specified collection (optional operation). |
boolean | removeIf(Predicate super E> filter) Removes all of the elements of this collection that satisfy the given predicate. |
boolean | retainAll(Collection> c) Retains only the elements in this set that are contained in the specified collection (optional operation). |
int | size() Returns the number of elements in this set (its cardinality). |
Stream | stream() Returns a sequential Stream with this collection as its source. |
SortedSet | subSet(E fromElement, E toElement) |
NavigableSet | subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) |
SortedSet | tailSet(E fromElement) |
NavigableSet | tailSet(E fromElement, boolean inclusive) |
Object[] | toArray() Returns an array containing all of the elements in this set. |
T[] | toArray(T[] a) Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array. |
String | toString() Returns a string representation of the object. |