I want to Group a list of objects by an attribute and then iterate the results using (Key, Value) pair.
I have found the way in Java 8 to group the list of objects with an attribute as follows
// filteredPageLog has the filtered results from PageLog entity.
Map<String, List<PageLog>> results =
filteredPageLog.stream().collect(Collectors.groupingBy(p -> p.getSessionId()));
But the results will have only entry sets(has values inside entrySet attribute). The keySet and valueSet will be having null values. I want to iterate something like
results.forEach((key,value) -> {
//logic
});