X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FClassLibrary%2FHashSet.java;h=4e4a1bcbaa4c9811f2b7218d09edab86a5430e12;hb=f392c3d93e4e445e188b98bea5b9f853e52f5812;hp=265ea23ba834340312481c170ba14130a0f13da8;hpb=967f892fb774953b0d6e9f684e4032f967c482ff;p=IRC.git diff --git a/Robust/src/ClassLibrary/HashSet.java b/Robust/src/ClassLibrary/HashSet.java index 265ea23b..4e4a1bcb 100644 --- a/Robust/src/ClassLibrary/HashSet.java +++ b/Robust/src/ClassLibrary/HashSet.java @@ -1,30 +1,33 @@ public class HashSet { - HashMap map; - HashSet() { - map=new HashMap(); - } - HashSet(int initialCapacity) { - map=new HashMap(initialCapacity); - } - HashSet(int initialCapacity, float loadFactor) { - map=new HashMap(initialCapacity, loadFactor); - } - public boolean add(Object o) { - return (map.put(o, this)==null); - } - public boolean remove(Object o) { - return (map.remove(o)!=null); - } - public boolean isEmpty() { - return map.isEmpty(); - } - public boolean contains(Object o) { - return map.containsKey(o); - } - public int size() { - return map.size(); - } - public HashMapIterator iterator() { - return map.iterator(0); - } + HashMap map; + HashSet() { + map=new HashMap(); + } + HashSet(int initialCapacity) { + map=new HashMap(initialCapacity); + } + HashSet(int initialCapacity, float loadFactor) { + map=new HashMap(initialCapacity, loadFactor); + } + public boolean add(Object o) { + return (map.put(o, this)==null); + } + public boolean remove(Object o) { + return (map.remove(o)!=null); + } + public boolean isEmpty() { + return map.isEmpty(); + } + public void clear() { + map.clear(); + } + public boolean contains(Object o) { + return map.containsKey(o); + } + public int size() { + return map.size(); + } + public HashMapIterator iterator() { + return (HashMapIterator)map.iterator(0); + } }