Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How collections are grouped by multiple fields in java

Shulou Source: shulou.com Published: 2022-06-02 10:25:58 09月22日 Update

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.

Tags: Multiple fields centrals grouping content more help good interest guys buddies articles knowledge articles references Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Linux Redmi Huawei Shulou Information