|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractSet
java.util.TreeSet
edu.neu.ccs.quick.QuickTreeSet
QuickTreeSet extends TreeSet by
adding two constructors and three methods addItems,
setItems, and removeItems that handle
an array of Object at once.
All constructors of the original TreeSet class
are provided as well.
No changes are made to the internal data structure.
The only inherited methods that are overridden are those that
will throw an exception on null arguments. In this
class, such methods will handle null in a sensible
fashion.
| Field Summary |
| Fields inherited from class java.util.TreeSet |
|
| Constructor Summary | |
QuickTreeSet()
A constructor that delegates to class TreeSet. |
|
QuickTreeSet(Collection c)
A constructor that delegates to class TreeSet. |
|
QuickTreeSet(Comparator c)
A constructor that delegates to class TreeSet. |
|
QuickTreeSet(Comparator c,
Object[] items)
Constructor that sets the Comparator and then
adds the given array of items one-by-one to the tree set. |
|
QuickTreeSet(Object[] items)
Constructor that adds the given array of items one-by-one to the tree set. |
|
QuickTreeSet(SortedSet s)
A constructor that delegates to class TreeSet. |
|
| Method Summary | |
boolean |
add(Object element)
Adds the element to the set if it is not present. |
void |
addItems(Object[] items)
Method that adds the given array of items one-by-one to the tree set. |
boolean |
contains(Object element)
Returns true if the set contains the element. |
SortedSet |
headSet(Object element)
Returns a view of the portion of this set whose elements are strictly less than the element. |
boolean |
remove(Object element)
Removes the element from the set if it is present. |
void |
removeItems(Object[] items)
Method that removes the given array of items one-by-one from the tree set. |
void |
setItems(Object[] items)
Method that first clears this tree set of any existing items and then adds the given array of items one-by-one to the tree set. |
SortedSet |
subSet(Object lower,
Object upper)
Returns a view of the portion of this set whose elements are greater than or equal to the element lower and strictly less than the element upper. |
SortedSet |
tailSet(Object element)
Returns a view of the portion of this set whose elements are greater than or equal to the element. |
| Methods inherited from class java.util.TreeSet |
addAll, clear, clone, comparator, first, isEmpty, iterator, last, size |
| Methods inherited from class java.util.AbstractSet |
equals, hashCode, removeAll |
| Methods inherited from class java.util.AbstractCollection |
containsAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray |
| Constructor Detail |
public QuickTreeSet()
TreeSet.
public QuickTreeSet(Collection c)
TreeSet.
public QuickTreeSet(Comparator c)
TreeSet.
public QuickTreeSet(SortedSet s)
TreeSet.
public QuickTreeSet(Object[] items)
Constructor that adds the given array of items one-by-one to the tree set.
items - the array of items to add to this tree setaddItems(Object[]),
QuickTreeSet(Comparator, Object[])
public QuickTreeSet(Comparator c,
Object[] items)
Constructor that sets the Comparator and then
adds the given array of items one-by-one to the tree set.
c - the comparatoritems - the array of items to add to this tree setaddItems(Object[]),
QuickTreeSet(Object[])| Method Detail |
public boolean add(Object element)
Adds the element to the set if it is not present.
If the element is null, then simply returns
false.
element - the element to be added to the set
TreeSet.add(Object)public boolean remove(Object element)
Removes the element from the set if it is present.
If the element is null, then simply returns
false.
element - the element to be removed from the set
TreeSet.remove(Object)public boolean contains(Object element)
Returns true if the set contains the element.
If the element is null, then simply returns
false.
element - the element to test for membership in the set
TreeSet.contains(Object)public SortedSet headSet(Object element)
Returns a view of the portion of this set whose elements are strictly less than the element. The returned sorted set is backed by this set, so changes in the returned sorted set are reflected in this set, and vice-versa.
The sorted set returned by this method will throw an
IllegalArgumentException if the user attempts to insert an
element greater than or equal to the given element.
If element is null, then simply returns null.
element - strict upper bound for the elements in the returned set
TreeSet.headSet(Object)public SortedSet tailSet(Object element)
Returns a view of the portion of this set whose elements are greater than or equal to the element. The returned sorted set is backed by this set, so changes in the returned sorted set are reflected in this set, and vice-versa.
The sorted set returned by this method will throw an
IllegalArgumentException if the user attempts to insert an
element less than the given element.
If element is null, then simply returns null.
element - lower bound for the elements in the returned set
TreeSet.tailSet(Object)
public SortedSet subSet(Object lower,
Object upper)
Returns a view of the portion of this set whose elements are greater than or equal to the element lower and strictly less than the element upper. The returned sorted set is backed by this set, so changes in the returned sorted set are reflected in this set, and vice-versa.
The sorted set returned by this method will throw an
IllegalArgumentException if the user attempts to insert an
element less than lower or greater than or equal to upper.
If either lower or upper is null, then simply returns
null.
lower - the lower bound for the elements in the returned setupper - the strict upper bound for the elements in the returned set
TreeSet.subSet(Object, Object)public void addItems(Object[] items)
Method that adds the given array of items one-by-one to the tree set.
If items is null, then does nothing.
Ignores individual null items.
items - the array of items to add to this tree setQuickTreeSet(Object[]),
QuickTreeSet(Comparator, Object[]),
setItems(Object[]),
removeItems(Object[])public void setItems(Object[] items)
Method that first clears this tree set of any existing items and then adds the given array of items one-by-one to the tree set.
If items is null, then this method
is equivalent to the inherited method clear.
Ignores individual null items.
items - the array of items to add to this tree set after clearanceaddItems(Object[]),
removeItems(Object[])public void removeItems(Object[] items)
Method that removes the given array of items one-by-one from the tree set.
If items is null, then does nothing.
Ignores individual null items.
items - the array of items to remove from this tree setaddItems(Object[]),
setItems(Object[])
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||