I want to create a Map from a List of Points and have inside the map all entries from the list mapped with the same parentId such as
Map
List
Points
The following code does the stuff. Collectors.toList() is the default one, so you can skip it, but in case you want to have Map> Collectors.toSet() would be needed.
Collectors.toList()
Map>
Collectors.toSet()
Map> map = pointList.stream() .collect(Collectors.groupingBy(Point::getParentId, Collectors.toList()));