0

I want to convert List to Map something like this:

List<Student> to Map<String, Student>

Specifically I want the key to be property of the Student object which is student id and the value to be the entire Student object. I want to use java 8 Stream Collector. I need something like:

Collectors.toMap(Strudent::getId, Student)

I can make a map from one property of the object to another property of the same object like Collectors.toMap(Strudent::getId, Student:getName) but I want the entire Student object as value.

VLAZ
  • 26,331
  • 9
  • 49
  • 67

0 Answers0