title: Removing from multiMap
body: <p>In school we are to implement our own class MultiMap. </p>
  
  <p>When I were implementing the remove method, I ran in to some trouble. </p>
  
  <p>My problem is when I call the remove method, the set.Remove(value) returns false. Just like if the set didn't contain the object. </p>
  
  <p>I've tried to write out the object refferences from the main, and the object reference from the MultiMap class, and the objects seems to be the same. </p>
  
  <p>What am I missing here? </p>
  
  <p>Thanks in advance</p>
  
  <p>Here's my map code :</p>
  
  <pre><code>public class MultiMap&lt;K, V&gt; {
  
  private final Map&lt;K, Set&lt;V&gt;&gt; map = new HashMap&lt;&gt;();
  
  public MultiMap() {
  }
  
  public String toString() {
      StringBuilder sb = new StringBuilder();
      Set&lt;K&gt; keys = map.keySet();
      for (K k : keys) {
          sb.append("key ");
          sb.append(k);
          sb.append(" Value ");
          sb.append(map.get(k));
      }
      return sb.toString();
  }
  
  public int size() {
      return map.size();
  }
  
      public boolean put(K key, V value) {
      Set&lt;V&gt; set;
      if (map.containsKey(key)) {
          set = map.get(key);
          set.add(value);
      } else {
          set = new HashSet&lt;&gt;();
          set.add(value);
      } 
      return (map.put(key, set) != null) ? false : true;
  }
  
  public Set&lt;V&gt; get(K key) {
      return map.get(key);
  }
  
  public void remove(K key, V value) {
      Set&lt;V&gt; set = map.get(key);
      System.out.println(value);
      System.out.println(set.remove(value));
      if(set.isEmpty()) {
          map.remove(key);
      }
  }
  </code></pre>
  
  <p>Main: </p>
  
  <pre><code>    public static void main(String[] args) {
      Person p = new Person("navn");
      Collection&lt;Person&gt; set = new HashSet&lt;&gt;();
      set.add(p);
      MultiMap map = new MultiMap&lt;&gt;();
      map.put(1, set);
      System.out.println(map.toString());
      System.out.println(map.get(1));
      map.remove(1, p);
  
  }
  </code></pre>