public interface SetTesterADT<K>
extends java.lang.Iterable<K>
Modifier and Type | Method and Description |
---|---|
void |
add(K key)
Add the key to the set.
|
void |
clear()
Clears all the keys in the set.
|
boolean |
contains(K key)
Return true iff the set contains the key.
|
void |
displayTree(int maxDisplayLevels)
Displays the set but only maxNumLevels from the top of the data
structure used by the implementation.
|
java.util.Iterator<K> |
iterator()
Returns an iterator for the set.
|
int |
size()
Returns the number of keys in the set.
|
java.util.List<K> |
subSet(K minValue,
K maxValue)
Returns the sorted list of keys in the tree that are in the specified
range (inclusive of minValue, exclusive of maxValue).
|
void add(K key)
key
- the key to addjava.lang.IllegalArgumentException
- if the key is nullDuplicateKeyException
- if the key is a duplicateboolean contains(K key)
key
- the key to searchjava.lang.IllegalArgumentException
- if the key is nulljava.util.List<K> subSet(K minValue, K maxValue)
minValue
- the minimum value of the desired range (inclusive)maxValue
- the maximum value of the desired range (exclusive)java.lang.IllegalArgumentException
- if either minValue or maxValue is
null, or minValue is larger than maxValuevoid clear()
int size()
void displayTree(int maxDisplayLevels)
maxDisplayLevels
- number of levels to display