API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util. TreeSet View Source
Author(s)
Josh Bloch
Since
1.2
Version
1.37, 05/10/06
Serial
Hierarchy
 Object
      AbstractCollection
          AbstractSet
              TreeSet
Implements
 NavigableSet
 Cloneable
 Serializable
Subclasses
Description
public class TreeSet
  A NavigableSet implementation based on a TreeMap.
Constructors
public TreeSet ()
  Constructs a new, empty tree set, sorted according to the natural ordering of its elements.
public TreeSet (Collection<Object> c)
  Constructs a new tree set containing the elements in the specified collection, sorted according to the natural ordering of its elements.
public TreeSet (Comparator<Object> comparator)
  Constructs a new, empty tree set, sorted according to the specified comparator.
pack-private TreeSet (NavigableMap< E, Object> m)
Constructs a set backed by the specified navigable map.
public TreeSet (SortedSet< E> s)
  Constructs a new tree set containing the same elements and using the same ordering as the specified sorted set.
Methods
Hide/Show inherited methods
public boolean add ( E e) [Overrides AbstractCollection]
  Adds the specified element to this set if it is not already present.
public boolean addAll (Collection<Object> c) [Overrides AbstractCollection]
  Adds all of the elements in the specified collection to this set.
public E ceiling ( E e) [Specified in NavigableSet]
 
public void clear () [Overrides AbstractCollection]
  Removes all of the elements from this set.
public Object clone ()
  Returns a shallow copy of this TreeSet instance.
public Comparator<Object> comparator ()
public boolean contains (Object o) [Overrides AbstractCollection]
  Returns true if this set contains the specified element.
public boolean containsAll (Collection<Object> c) [Inherited From AbstractCollection]
  Returns true if this collection contains all of the elements in the specified collection.
public Iterator< E> descendingIterator () [Specified in NavigableSet]
  Returns an iterator over the elements in this set in descending order.
public NavigableSet< E> descendingSet () [Specified in NavigableSet]
 
public boolean equals (Object o) [Inherited From AbstractSet]
  Compares the specified object with this set for equality.
public E first ()
 
public E floor ( E e) [Specified in NavigableSet]
 
public int hashCode () [Inherited From AbstractSet]
  Returns the hash code value for this set.
public SortedSet< E> headSet ( E toElement) [Specified in NavigableSet]
 
public NavigableSet< E> headSet ( E toElement, boolean inclusive) [Specified in NavigableSet]
 
public E higher ( E e) [Specified in NavigableSet]
 
public boolean isEmpty () [Overrides AbstractCollection]
  Returns true if this set contains no elements.
public Iterator< E> iterator () [Specified in NavigableSet]
  Returns an iterator over the elements in this set in ascending order.
public E last ()
 
public E lower ( E e) [Specified in NavigableSet]
 
public E pollFirst () [Specified in NavigableSet]
 
public E pollLast () [Specified in NavigableSet]
 
public boolean remove (Object o) [Overrides AbstractCollection]
  Removes the specified element from this set if it is present.
public boolean removeAll (Collection<Object> c) [Inherited From AbstractSet]
  Removes from this set all of its elements that are contained in the specified collection (optional operation).
public boolean retainAll (Collection<Object> c) [Inherited From AbstractCollection]
  Retains only the elements in this collection that are contained in the specified collection (optional operation).
public int size () [Specified in AbstractCollection]
  Returns the number of elements in this set (its cardinality).
public NavigableSet< E> subSet ( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) [Specified in NavigableSet]
 
public SortedSet< E> subSet ( E fromElement, E toElement) [Specified in NavigableSet]
 
public SortedSet< E> tailSet ( E fromElement) [Specified in NavigableSet]
 
public NavigableSet< E> tailSet ( E fromElement, boolean inclusive) [Specified in NavigableSet]
 
public Object toArray () [Inherited From AbstractCollection]
  Returns an array containing all of the elements in this collection.
public T toArray ( T a) [Inherited From AbstractCollection]
  Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.
public String toString () [Inherited From AbstractCollection]
  Returns a string representation of this collection.
Fields
Hide/Show inherited fields
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar