title: Remove duplicate element from the set in java
body: <p>I have set of string array and i want to remove duplicate elements from this...</p>
  
  <pre><code>    String[] arr1 = {"a1","b1"};
      String[] arr2 = {"a2","b2"};
      Set&lt;String[]&gt; mySet = new HashSet&lt;String[]&gt;();
      mySet.add(arr1);
      mySet.add(arr2);
      mySet.add(new String[] {"a1","b1"});
      System.out.print(mySet.size());
  </code></pre>
  
  <p>Currently mySet looks like this:</p>
  
  <pre><code>[{"a1","b1"},{"a2","b2"},{"a1","b1"}]
  </code></pre>
  
  <p>But I want like this:</p>
  
  <pre><code>[{"a1","b1"},{"a2","b2"}]
  </code></pre>
  
  <p>I know some ways...</p>
  
  <ol>
  <li>Every time I need to run inner loop and check whether its duplicate or not.</li>
  <li>Can I override the set's behavior? (hashcode or equals)? ( i do not know how....)</li>
  <li>Do I need to change data structure for this? (linkedhashset or list or any other suitable data structure for this?)</li>
  </ol>