title: Contains and remove methods for instances user-defined classes in a list?
body: <p>So I have this code:</p>
  
  <pre><code>List&lt;MyDataType&gt; test = map.get(id)
  MyDataType test1 = new MyDataType("XXX", 1); 
  System.out.println(test.contains(test1)); // returns false
  System.out.println(test.get(0).equals(test1)); // returns true
  System.out.println(test.remove(test1)); // returns false 
  System.out.println(test); // still the original list
  </code></pre>
  
  <p>I have already overridden the <code>.equals</code> and <code>.hashCode()</code> methods in MyDataType, and it is consistent. Furthermore, <code>map</code> is of type <code>ListMultimap&lt;Long, DestQuanTuple&gt;</code> (forgot to mention this in my OP.) However, the call:
  <code>map.remove(sourceContainerId, test1)</code> does not modify <code>test</code> either.</p>
  
  <p>The <code>MyDataType</code> class:</p>
  
  <pre><code>public class MyDataType implements Comparable&lt;MyDataType&gt; {
      private String destination;
      private int quantity;
  
      // Constructor initializes destination and quantity
  
      // Getters exist to get destination and quantity
  
      public boolean equals (MyDataType other) {
          boolean destinationSame = false, quantitySame = false;
          destinationsame = this.getDestination().equals(other.getDestination());
          Integer thisQuantity = (Integer) this.getQuantity();
          Integer otherQuantity = (Integer) other.getQuantity();
          quantitySame = thisQuantity.equals(otherQuantity);
          return destinationSame &amp;&amp; quantitySame;
      }
  
      public int hashCode() {
          return destination.hashCode() + quantity;
      }
  
      public int compareTo(MyDataType other) {
          Integer myQuantity = this.getQuantity();
          if (myQuantity.compareTo(other.getQuantity()) != 0) {
              return myQuantity.compareTo(otherTuple.getQuantity());
          }
          else {
              return this.getDestination().compareTo(otherTuple.getDestination());
          }
      }
  }
  </code></pre>
  
  <p>Any idea why I'm not getting the functionality I want?</p>