AC
TreeSet<String> uniqueSentences = new TreeSet<>();а то мне выдает просто файл без изменений, только в ловер кейс конвертит
while (file.hasNext()) {
// Convert the word to lower case, trim it and insert into the set
// In this step, you will probably want to remove punctuation marks
uniqueSentences.add(file.next().trim().toLowerCase());
}