求Java高手解题*@paramaStringdenotingtheinputPaththepathonthelocalfilesystem*totheinputfile*@returnsaHashMapcontainingtheword->countmappings**Thismethodmus...
求Java 高手 解题
* @param a String denoting the inputPath the path on the local filesystem
* to the input file
* @returns a HashMap containing the word->count mappings
*
* This method must read the contents of a file (identified by inputFilePath),
* one char at a time, segment the input into words, and keep track of word
* counts in a java.util.HashMap.
*
* A word is defined as a contiguous sequence of characters that does not
* contain word separator characters, where word separator characters are:
* ' ' (space), '\t' (tab), '\n' (newline), ',' (comma) and '.' (period).
*
* Think carefully about this definition, and how it applies to an initial
* character sequence not preceded by a word separator, and also a final
* character sequence not followed by a word separator.
*
* You must use only CharacterFromFileReader to read characters from the input
* file. Use it as an Iterator, keeping in mind the autoboxing &
* unboxing feature of the Java language.
*
* In order to keep your code readable, break your code into several methods.
* Define meaningful private helper methods that you call from the required
* public method.
展开