title: Remove element from HashSet
body: <p>First of all add the element in HashSet and prints the size of HashSet which returns as expected. but i modified one of the object value and again store in to HashSet and remove the object using object name. but still i get the same size as previous. My code is as under : </p>
  
  <pre><code>public class Test {
  
      private String s;
      public Test(String s){
          this.s  = s ;
      }
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          HashSet&lt;Object&gt; hs = new HashSet&lt;Object&gt;();
          Test t1 = new Test("Keval");
          Test t2 = new Test("Keval");
  
          String s1 = new String("Keval");        
  
          hs.add(t1);
          hs.add(t2);
          hs.add(s1);     
          System.out.println("Set Size :: " + hs.size());
  
          s1 = new String("Demo");        
          hs.remove(s1);
          System.out.println("Set Size :: " + hs.size());
  
  
      }
  }
  </code></pre>
  
  <p>Output of above code is :</p>
  
  <pre><code>Set Size :: 3
  Set Size :: 3    // Why it prints 3 insted of 2???
  </code></pre>