For example I want to pick up the key "DEPARTMENT_NAME" all the values, the boy all the values, how should respectively take? The final result is to use the map to return to the front desk,
This is the specific code
I want to save and use the map to loop back to just know the map in the same key value will overwrite the previous one, so finally got only a value
Because I want to do is to use echarts to show different college, the number of boys and girls, need three parameters: school, boys and girls, so I just need to get at the front desk sets, and a collection of both men and women of the college is ok, don't know how to take each of these three parameters values? For a great god
CodePudding user response:
Is too low or it's a difficult problem, ask the great spiritCodePudding user response:
Not really no oneCodePudding user response:
Not very understand which is the data required to format, but would like to deposit your repeat key words can try MultiMapCodePudding user response:
Has been solved, why I must to the map, three parameters are put forward in the for loop for three of the list is not finished, and then use stringbuilder joining together, and then use the map set a key parameters, put the builder to the value of the position, to return to the front desk,Alas, it is a very simple question to want to so complicated, I don't know will meet what kind of problems in the later work
CodePudding user response:
Look at the steam related thingsCodePudding user response:
A for loop not done?Return to the map in college name as the key to (college school boys, the total number of girls) as the value is ok
MapThe map=new HashMap<> (a);
For (Dto count: the count List) {
The map. The put (count. GetAsString (" DEPARTMENT_NAME "),
The String. Format (" % d, % s, % s ", count. GetAsInteger (" boys ") + count. GetAsInteger (" girls "), and count. GetAsInteger (" boys "), count. GetAsInteger (" girls ")));
}
CodePudding user response:
CountList. Stream (). The map (s - & gt; S.g et (" DEPARTMENT_NAME ");) Collect (Collectors. ToList ())CodePudding user response: