The following is the code that I have written so far for an assignment. I am having difficulty testing my methods so far. In the main method, I try to create a SimpleSet setA = new SimpleSet() but I keep getting an error. Can anyone help me? Thank you.
import java.util.*; public class SimpleSet<K extends Comparable<? super K>>{ /* use SimpleSortedDictionary object to hold set items Note: Value is not needed, just set it to Boolean */ private DictionaryInterface<K, Boolean> items; /* default constructor */ public SimpleSet() { items = new SimpleSortedDictionary<K, Boolean>(); } /* Adds a given object to the set. If the given object already exists in the set, return false; otherwise, return true */ public boolean add(K item){ boolean result; if(items.add(item, true) != null) { result = true; }else result = false; return result; } /* Removes a given object from the set. */ public void remove(K item){ this.items.remove(item); } /* Sees whether the set contains a given object. */ public boolean contains(K item){ return this.items.contains(item); } /* Clears all objects from the set. */ public void clear(){ items.clear(); } /* Gets the number of objects in the set. */ public int getSize(){ return items.getSize(); } /* Returns an iterator to the set. */ public Iterator<K> getIterator(){ return items.getKeyIterator(); } /* may define tests here */ public static void main(String args[]) { SimpleSet setA = new SimpleSet<K>(); int five = 5; setA.add(five); System.out.print(setA); //SimpleSet setA = new SimpleSet(); //SimpleSet setA = new SimpleSortedDictionary(); //Integer five = new Integer(5); //setA.add(five); //setA.toString(); } } } // end SimpleSet