title: Remove case sensitive duplicate elements from list in java
body: <p>So I have let's say a list of Strings like {"a","A","b","B","C","D","d","E"}</p>
  
  <p>My requirement is that I want to remove duplicate elements from this string. I will specify in beginning whether elements to be considered for removing will be in lowercase or uppercase.</p>
  
  <p>I know traditional approaches like using a for loop and then processing each element based on requirement. But I want to know much better approach to achieve this using java.</p>
  
  <p>This is my approach :</p>
  
  <p>String[] str = { "a", "A", "b", "B", "C", "D", "d", "E" };
          HashSet s = new HashSet();</p>
  
  <pre><code>    for (String alphabet : str) {
  
          if (alphabet.equals(alphabet.toUpperCase())) {
  
              s.add(alphabet);
          }
      }       
  
      System.out.println(s);
  </code></pre>