February 2014
Beginner
1248 pages
62h 25m
English
Lines 19–24 summarize contents of the text file "Chapter2Paragraph.txt" (which is located in the folder with the example) into a Map<String, Long> in which each String key is a word in the file and the corresponding Long value is the number of occurrences of that word. The statement performs the following tasks:
• Line 20 uses Files method lines to create a Stream<String> for reading the lines of text from a file. Class Files (package java.nio.file) is one of many classes throughout the Java APIs that have been enhanced to support Streams.
• Line 21 uses Stream method map to remove all the punctuation, except apostrophes, in the lines of text. The lambda argument represents a Function that ...
Read now
Unlock full access