I have a list
PLANS:
ID, A_CODE, COMPARTMENT
10683 163 213
10683 616 194
10683 163 212
10683 163 211
10683 163 214
and want to produce AGGREGATED_PLANS
ID A_CODE COMPARTMENTS
10683 163 211/212/213/214
10683 616 194
How can I do this using java lambda expression ?
I am thinking something like this, but not sure about the aggregateCompartments part ?
plans.stream()
.collect(groupingBy(Plan::getACode,
aggregateCompartments(Plan::getCompartments)));
Any suggestions ?
groupingBy(Plan::getACode, mapping(Plan::getCompartments, joining("/")), help?