To demonstrate the usage of groupingBy(), let's define a BlogPost class (we will use a stream of BlogPost objects): class BlogPost { String title; String author; BlogPostType type; int likes; } Next, the BlogPostType: enum BlogPostType { NEWS, REVIEW, GUIDE } Then the List of BlogPost objects: List<BlogPost> posts = Arrays.asList( ... ); Let's also define a Tuple class that will be used to group posts by the combination of their type and author attributes: