I am loading a log file as input stream and need to do aggregate processing on the matching values on each line, also I need to store duplicates while saving the lines in MultiMap, I am finding trouble collecting the below stream stored into List as Multimap<String, List<String>>
try (Stream<String> stream = Files.lines(Paths.get(inFileName))) {
List<String> matchedValues = stream
.flatMap(s -> MultiPatternSpliterator.matches(s, p1))
.map(r -> r.group(1))
.collect(Collectors.toList());
matchedValues.forEach(System.out::println);
}
How to convert the same to store the values in Map with duplicate values.