public class ArrayListSetTester<K extends java.lang.Comparable<K>> extends java.lang.Object implements SetTesterADT<K>
| Modifier and Type | Field and Description |
|---|---|
(package private) java.util.List<K> |
listSet |
| Constructor and Description |
|---|
ArrayListSetTester() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(K item)
Add the key to the set.
|
void |
clear()
Clears all the keys in the set.
|
boolean |
contains(K item)
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).
|
public void add(K item)
SetTesterADTadd in interface SetTesterADT<K extends java.lang.Comparable<K>>item - the key to addpublic boolean contains(K item)
SetTesterADTcontains in interface SetTesterADT<K extends java.lang.Comparable<K>>item - the key to searchpublic java.util.List<K> subSet(K minValue, K maxValue)
SetTesterADTsubSet in interface SetTesterADT<K extends java.lang.Comparable<K>>minValue - the minimum value of the desired range (inclusive)maxValue - the maximum value of the desired range (exclusive)public void clear()
SetTesterADTclear in interface SetTesterADT<K extends java.lang.Comparable<K>>public int size()
SetTesterADTsize in interface SetTesterADT<K extends java.lang.Comparable<K>>public void displayTree(int maxDisplayLevels)
SetTesterADTdisplayTree in interface SetTesterADT<K extends java.lang.Comparable<K>>maxDisplayLevels - number of levels to displaypublic java.util.Iterator<K> iterator()
SetTesterADT