Transform a List<Object> to a Map<String, Integer> such that the String is not a duplicate value using Java 8 Streams
- 阅读更多 关于 Transform a List to a Map such that the String is not a duplicate value using Java 8 Streams
问题 We have a Student class as follows: class Student { private int marks; private String studentName; public int getMarks() { return marks; } public void setMarks(int marks) { this.marks = marks; } public String getStudentName() { return studentName; } public void setStudentName(String studentName) { this.studentName = studentName; } public Student(String studentName, int marks) { this.marks = marks; this.studentName = studentName; } } We have a LIST of Students as follows : List<Student>