From 87d63321677ab3001d8c71a0437862f445afb2a1 Mon Sep 17 00:00:00 2001
From: Caleb Sander <caleb.sander@gmail.com>
Date: Tue, 25 Feb 2020 18:07:45 -0800
Subject: [PATCH] Fix return value from ISet.add()

---
 src/edu/caltech/cs2/interfaces/ISet.java | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/src/edu/caltech/cs2/interfaces/ISet.java b/src/edu/caltech/cs2/interfaces/ISet.java
index c99dcde..61e179e 100644
--- a/src/edu/caltech/cs2/interfaces/ISet.java
+++ b/src/edu/caltech/cs2/interfaces/ISet.java
@@ -79,7 +79,7 @@ public class ISet<E> implements Iterable<E> {
      *         element
      */
     public boolean add(E e) {
-        return this.internalDictionary.put(e, new Object()) != null;
+        return this.internalDictionary.put(e, new Object()) == null;
     }
 
 
@@ -100,17 +100,6 @@ public class ISet<E> implements Iterable<E> {
         return this.internalDictionary.remove(e) != null;
     }
 
-    /**
-     * Removes all of the elements from this set (optional operation).
-     * The set will be empty after this call returns.
-     *
-     * @throws UnsupportedOperationException if the {@code clear} method
-     *         is not supported by this set
-     */
-    public void clear() {
-        throw new UnsupportedOperationException();
-    }
-
     @Override
     public String toString() {
         StringBuilder b = new StringBuilder();
-- 
GitLab