I am trying to get product reviews Map based on their name and need a map like
Map<String, Set<String>> productReviewMap;
but when I try to get the map I am getting
Map<String, Set<Set<String>>> productReviewMap
based on following code :
Map<String, Set<Set<String>>> productReviewMap = products.stream().collect(
Collectors.groupingBy(Product::getName, Collectors.mapping(Product::getReviews, Collectors.toSet())));
How I can get the expected map. We use flatMap in streams but how can I achieve it in collectors ?