'Get the list based on its size from a Map of List using Java 8

I have a Map<String, List<String>>. I am trying to retrieve all the List<String> from the map which has size > 1 and collect them to a new list.

Trying to find out a way to do it in Java 8.

Below is how I tried to implement the code but I get a List<String, List<String>>

map.entrySet().stream()
   .filter(e->e.getValue().size()>1)
   .collect(Collectors.toList())

What can be the way to achieve it in Java 8.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source