Given:
class Student {
String course, name, city;
public Student (String name, String course, String city) {
this.course = course; this.name = name; this.city = city;
}
public String toString() {
return course + ":" + name + ":" + city;
}
and the code fragment:
List<Student> stds = Arrays.asList(
new Student ("Jessy", "Java ME", "Chicago"),
new Student ("Helen", "Java EE", "Houston"),
new Student ("Mark", "Java ME", "Chicago"));
stds.stream()
.collect(Collectors.groupingBy(Student::getCourse))
.forEach(src, res) -> System.out.println(scr));
What is the result?
Innovation
Highly Voted 4 years, 6 months agoOhayou
2 years, 4 months agoshivkumarx
4 months agoChoucou
Highly Voted 4 years, 10 months agoasdfjhfgjuaDCV
Most Recent 4 months, 2 weeks agosteefaand
5 months, 2 weeks agor1muka5
1 year, 4 months agoMahdiHamdii
1 year, 7 months agoOhayou
2 years, 4 months agolnrdgst
2 years, 1 month agoWilsonKKerll
2 years, 4 months agochichikim
2 years, 7 months agoSamps
3 years, 11 months agoOhayou
2 years, 4 months agorameasy
3 years, 11 months agojohnchen88
4 years, 5 months ago