Java java.util TreeSet fields, constructors, methods, implement or subclass

Example usage for Java java.util TreeSet fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.util TreeSet.

The text is from its open source code.

Subclass

java.util.TreeSet has subclasses.
Click this link to see all its subclasses.

Constructor

TreeSet()
Constructs a new, empty tree set, sorted according to the natural ordering of its elements.
TreeSet(NavigableMap m)
Constructs a set backed by the specified navigable map.
TreeSet(Comparator comparator)
Constructs a new, empty tree set, sorted according to the specified comparator.
TreeSet(Collection c)
Constructs a new tree set containing the elements in the specified collection, sorted according to the natural ordering of its elements.
TreeSet(SortedSet s)
Constructs a new tree set containing the same elements and using the same ordering as the specified sorted set.

Method

booleanadd(E e)
Adds the specified element to this set if it is not already present.
booleanaddAll(Collection c)
Adds all of the elements in the specified collection to this set.
Eceiling(E e)
voidclear()
Removes all of the elements from this set.
Objectclone()
Returns a shallow copy of this TreeSet instance.
Comparatorcomparator()
booleancontains(Object o)
Returns true if this set contains the specified element.
booleancontainsAll(Collection c)
Returns true if this set contains all of the elements of the specified collection.
IteratordescendingIterator()
Returns an iterator over the elements in this set in descending order.
NavigableSetdescendingSet()
booleanequals(Object o)
Compares the specified object with this set for equality.
Efirst()
Efloor(E e)
voidforEach(Consumer action)
Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.
SortedSetheadSet(E toElement)
Ehigher(E e)
booleanisEmpty()
Returns true if this set contains no elements.
Iteratoriterator()
Returns an iterator over the elements in this set in ascending order.
Elast()
Elower(E e)
EpollFirst()
EpollLast()
booleanremove(Object o)
Removes the specified element from this set if it is present.
booleanremoveAll(Collection c)
Removes from this set all of its elements that are contained in the specified collection (optional operation).
booleanremoveIf(Predicate filter)
Removes all of the elements of this collection that satisfy the given predicate.
booleanretainAll(Collection c)
Retains only the elements in this set that are contained in the specified collection (optional operation).
intsize()
Returns the number of elements in this set (its cardinality).
Streamstream()
Returns a sequential Stream with this collection as its source.
SortedSetsubSet(E fromElement, E toElement)
NavigableSetsubSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
SortedSettailSet(E fromElement)
NavigableSettailSet(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.
StringtoString()
Returns a string representation of the object.