Check out example codes for "java 8 group a collections by 2 property". It will help you in understanding the concepts better.

Code Example 1

Map<String, Map<BlogPostType, List>> map = posts.stream()
  .collect(groupingBy(BlogPost::getAuthor, groupingBy(BlogPost::getType)));

Learn ReactJs, React Native from akashmittal.com