If you have a file with come words or terms on each line, you may want to sort it. Java Arrays.sort is common nice function to do this. Collections.sort() is another nice say. Here is an example and code.
E.G. in a file, you have the following txt.
dog cat --windows --kankan pps game --annot be guaranteed as it is, generally speaking, --impossible to make any hard gu arantees in the p --resence of unsynchr