The objective is to count distinct words from a file.
UPDATE: Previous Code was successfully finished. Now I have to do the same but using threads (Oh
Why don't you sinply try something like:
public int countWords(File file) { Scanner sc = new Scanner(file); Set<String> allWords = new HashSet<String>(); while(sc.hasNext()) { allWords.add(sc.next()); } return allWords.size(); }