How to find a string which is case-sensitive and ignore it in JAVA
<p>I have a text file (T1.txt) in which it has few strings.out of them 2 are similar but case-sensitive. I have to ignore the other one and get the rest of them..</p>

<p>e.g.. ABCD, XYZ, pqrs, aBCd.</p>

<p>i am using Set to return the strings.. but how I can ignore the duplicate and return only one string( either of ABCD , aBCd).</p>

<pre><code>public static Set findDuplicates(File inputFile)
{
 FileInputStream fis = null;
    BufferedInputStream bis = null;
    DataInputStream dis = null;
    Set&lt;String&gt; set = new HashSet&lt;String&gt;();
    ArrayList&lt;String&gt; inpArrayList = new ArrayList&lt;String&gt;();

    try{

        fis = new FileInputStream(inputFile);

        bis = new BufferedInputStream(fis);
        dis = new DataInputStream(bis);

        while (dis.available() != 0) 
        {
           inpArrayList.add(dis.readLine());
        }

         for(int i=0; i &lt; inpArrayList.size(); i++)
         {
             if(!set.contains(inpArrayList.get(i)))
                set.add(inpArrayList.get(i));
        }

    }
    catch (FileNotFoundException e) {
  e.printStackTrace();
} catch (IOException e) {
  e.printStackTrace();
}
System.out.println(" set" +  set);
return set;        
}
</code></pre>

<p>The returning set shall contain only  XYZ, pqrs, aBCd or ABCD. but not both.</p>

<p>Thanks
Ramm</p>
