+1  A: 

If you add the lines into a Set (as the keys) rather than an Array you'll find you don't need to do any of the duplicate processing. It'll be taken care of for you and your program will be simpler and shorter.

Trevor Tippins
A: 

Actually your code needs some improvements, but what comes to me most wrong is to make comparison with not trimmed string then while putting it to lines array using trimmed string of fetched line.

lines[i].equals(strLine) // instead use "lines[i].equals(strLine.trim())"
erdemoo
+1  A: 

Arrays are not the data structures you want here (do you need a data structure with a fixed length and ordering but with mutable elements?). Have a look at the collection types in java.util. In particular, look at the SortedSet implementations like TreeSet. This will:

  1. Expand to hold the data
  2. Eliminate duplicates (it is a Set)
  3. Sort its contents as you add them (see Comparator implementations like String.CASE_INSENSITIVE_ORDER)
McDowell