Package java.util

Class TreeSet

extends AbstractSetAbstractCollectionObject
implements SortedSet, Cloneable, Serializable, Set, Collection

Implements the Set interface, backed by a TreeMap instance. This class guarantees that the sorted set will be in ascending order, according to natural order or according to order induced by the comparator provided at set creation time.

Note that the ordering must be consistent with the equals relation.

Note that this implementation is not synchronized. If multiple threads access a set concurrently, and at least one of the threads modifies the set, it must be synchronized externally. This is typically accomplished by synchronizing on some object that naturally encapsulates the set. If no such object exists, the set should be "wrapped" using the Collections.synchronizedSet method. Iterators of this class are fail-fast, i.e. if the set is modified at any time after the iterator is created, in any way except through the iterator's own remove method, the iterator will throw a ConcurrentModificationException.

This implementation provides guaranteed log(n) time cost for the basic operations (add, remove and contains).

Public Constructors

Public Methods

Methods inherited from java.util.AbstractSet

Methods inherited from java.util.AbstractCollection

Methods inherited from java.lang.Object

_INSERT_INHERITED_METHOD_ENTRY_HERE_

_INSERT_FIELDS_ENTRY_HERE_