Skip to content

Instantly share code, notes, and snippets.

@lubaochuan
Created December 6, 2022 21:16
Show Gist options
  • Save lubaochuan/bfdf2716c6a945618117665942f231f5 to your computer and use it in GitHub Desktop.
Save lubaochuan/bfdf2716c6a945618117665942f231f5 to your computer and use it in GitHub Desktop.
import java.util.LinkedList;
import java.util.Iterator;
public class MyTreeSet{
MyTreeMap map = new MyTreeMap();
public void add(String key){
// TO BE IMPLEMENTED
// return false;
// add key to set
// return true if key is new, false otherwise
map.put(key, null);
}
public Iterator<String> keys(){
// TO BE IMPLEMENTED
// return an iterator of keys
// return null;
return map.keys();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment