In this tutorial you will learn how to extract distinct words from file using Java 8 Stream API. Files.lines() method returns a stream of strings from a specified file. Then further, we use to read each lines and splitting the words with the help of regular expression. Once all the words are separated then extract the distinct words from all the elements of the single stream produced by the flatMap().
Read More