How collections are grouped by multiple fields in java
This article introduces how the collection in java is grouped by multiple fields, the content is very detailed, interested friends can refer to it, I hope it can be helpful to you.
List students=new ArrayList (); students.add (new Student ("yyf", 10,170); students.add (new Student ("yyf", 20,170)); students.add (new Student ("yyf2", 10,180)); students.add (new Student ("yyf2", 20,180)); students.add (new Student ("yyf3", 10,180)); students.add (new Student ("yyf3", 20,180 ")) Students.add (new Student ("yyf3", 30,180)); Map collect = students.stream (). Collect (Collectors.groupingBy (value-> value.getName () + "#" + value.getLength ()); System.out.println (collect.toString ()); about how collections in java are grouped into multiple fields to share here. I hope the above can be helpful and learn more. If you think the article is good, you can share it for more people to see.