title: contains() method in java.util.HashSet doesn't behave as i expected from it
body: <p>This is the java main() method:</p>
  <pre><code>
  
      public static void main(String[] args) {
          
          HashSet set = new HashSet();
          Mapper test = new Mapper("asd", 0);
          set.add(test);
          
          System.out.println(new Mapper("asd", 0).equals(test));
          System.out.println(set.contains(new Mapper("asd", 0)));
          
      }
  
  </code></pre>
  <p>and my Mapper class is :</p>
  <pre><code>class Mapper {
  
  String word;
  Integer counter;
  
  Mapper (String word, Integer counter) {
      
      this.word = word;
      this.counter = counter;
      
  }
  
  public boolean equals(Object o) {
      
      if ((o instanceof Mapper) &amp;&amp; (((Mapper)o).word == this.word)) {
          
          return true;
          
      }
      
      return false;
      
  }
  
  }
  </code></pre>
  <p>and the result is :</p>
  <blockquote>
  <p>true</p>
  <p>false</p>
  </blockquote>
  <p>From HashSet specifications, at this method I read this : &quot;Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that (o==null ? e==null : o.equals(e)). &quot;</p>
  <p>So, can anyone explain me where i'm wrong? Or ...?</p>
  <p>Thanks.</p>