I\'m kinda new to Java 8\'s new features. I am learning how to filter a map by entries. I have looked at this tutorial and this post for my problem, but I am unable to solve. >
The message is misleading but your code does not compile for another reason: collect returns a Map not a HashMap.
collect
Map
HashMap
If you use
Map map = new HashMap<>();
it should work as expected (also make sure you have all the relevant imports).