|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweiss.util.AbstractCollection<AnyType>
weiss.util.TreeSet<AnyType>
public class TreeSet<AnyType>
Balanced search tree implementation of SortedSet. Matches are based on comparator or compareTo.
Constructor Summary | |
---|---|
TreeSet()
Construct an empty TreeSet. |
|
TreeSet(Collection<? extends AnyType> other)
Construct a TreeSet from any collection. |
|
TreeSet(Comparator<? super AnyType> c)
Construct an empty TreeSet with a specified comparator. |
|
TreeSet(SortedSet<AnyType> other)
Construct a TreeSet from another SortedSet. |
Method Summary | |
---|---|
boolean |
add(AnyType x)
Adds an item to this collection. |
void |
clear()
Change the size of this collection to zero. |
Comparator<? super AnyType> |
comparator()
Return the comparator used by this TreeSet. |
boolean |
contains(java.lang.Object x)
Tests if some item is in this collection. |
AnyType |
first()
Find the smallest item in the set. |
AnyType |
getMatch(AnyType x)
This method is not part of standard Java. |
Iterator<AnyType> |
iterator()
Obtains an Iterator object used to traverse the collection. |
AnyType |
last()
Find the largest item in the set. |
boolean |
remove(java.lang.Object x)
Removes an item from this collection. |
int |
size()
Returns the number of items in this collection. |
Methods inherited from class weiss.util.AbstractCollection |
---|
equals, hashCode, isEmpty, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface weiss.util.Collection |
---|
isEmpty, toArray, toArray |
Constructor Detail |
---|
public TreeSet()
public TreeSet(Comparator<? super AnyType> c)
public TreeSet(SortedSet<AnyType> other)
public TreeSet(Collection<? extends AnyType> other)
Method Detail |
---|
public Comparator<? super AnyType> comparator()
comparator
in interface SortedSet<AnyType>
public int size()
size
in interface Collection<AnyType>
public AnyType first()
first
in interface SortedSet<AnyType>
NoSuchElementException
- if the set is empty.public AnyType last()
last
in interface SortedSet<AnyType>
NoSuchElementException
- if the set is empty.public AnyType getMatch(AnyType x)
getMatch
in interface Set<AnyType>
x
- the object to search for.
public boolean contains(java.lang.Object x)
contains
in interface Collection<AnyType>
contains
in class AbstractCollection<AnyType>
x
- any object.
public boolean add(AnyType x)
add
in interface Collection<AnyType>
add
in class AbstractCollection<AnyType>
x
- any object.
public boolean remove(java.lang.Object x)
remove
in interface Collection<AnyType>
remove
in class AbstractCollection<AnyType>
x
- any object.
public void clear()
clear
in interface Collection<AnyType>
clear
in class AbstractCollection<AnyType>
public Iterator<AnyType> iterator()
iterator
in interface java.lang.Iterable<AnyType>
iterator
in interface Collection<AnyType>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |