I\'m trying to perform an assignment that first counts the number of files in a directory and then give a word count within each file. I got the file count alright, but I\'m
Word count example:
Files.lines(Paths.get(file))
.flatMap(line -> Arrays.stream(line.trim().split(" ")))
.map(word -> word.replaceAll("[^a-zA-Z]", "").toLowerCase().trim())
.filter(word -> !word.isEmpty())
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
Files count:
Files.walk(Paths.get(file), Integer.MAX_VALUE).count();
Files.walk(Paths.get(file)).count();