Duplicate Line Finder I recently wrote a program that reads a plain text file, and compares every line and alerts you if any are similar, based on a float value that you pass in to a function.

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;

public class DuplicateLineFinder {

    public static void main(String[] args) throws IOException {

        final float SIMILARITY_RATE = 0.75f;

        String fileLocation = System.getProperty("user.home") + "/Desktop/";
        String fileName = "lines.txt";
        BufferedReader file = new BufferedReader(new FileReader(fileLocation + fileName));

        List&lt;String&gt; lines = new ArrayList&lt;String&gt;();
        String line;
        while((line = file.readLine()) != null) {
            lines.add(line);
        } 

        for (int i = 0; i &lt; lines.size()-2; i++) {
            for (int j = i+1; j &lt; lines.size()-1; j++) {

                if (IsSimilar(lines.get(i), lines.get(j), SIMILARITY_RATE))
                    System.out.println("WARNING!\n " + lines.get(i) + "\n and \n" + lines.get(j) + "\n might be the same");
            }
        }

        file.close();
    }

    public static boolean IsSimilar(String line1, String line2, float percentSimilar) {
        int duplicateWordCount = 0;
        List&lt;String&gt; words1 = new LinkedList&lt;String&gt;(Arrays.asList(line1.split(" ")));
        List&lt;String&gt; words2 = new LinkedList&lt;String&gt;(Arrays.asList(line2.split(" ")));

        if (words1.size() &gt;= words2.size()) {
            for (String word : words2) {
                if (words1.remove(word)) {
                    duplicateWordCount++;
                }
            }

            if (duplicateWordCount &gt; (words2.size() * percentSimilar)) return true;
        }

        else if (words2.size() &gt; words1.size()) {
            for (String word : words1) {
                if (words2.remove(word)) {
                    duplicateWordCount++;
                }
            }

            if (duplicateWordCount &gt; (words1.size() * percentSimilar)) return true;
        }

        return false;
    }

}


It works well, and is customisable in case you want to make it more/less strict. I am wondering if there is a better way to do my if statements in the IsSimilar function, as without them it doesn't work as well.
To test case, you can use toLowerCase() and toUpperCase() methods in String to get case. Also using String, you can use the split(' ') method to get each word and compare them instead of using two lists. It would definately increase performance to some extent. 

To get the contents a bit better, the new nio package was updated in java 8 and has methods like Files.readAllLines(Path p);, returning a List (a list of lines) instead of using the BufferedReader trick. You can also use readAllBytes(Path p); which will return a byte array, but it is much easier to use readAlLines for your case.

Other than that I don't think there is much to give you. You have done a good job.