I have an ArrayList (inputList) that parse this data:
id,name,quantity
1,foo,10
2,bar,20
3,foo,10
4,bar,10
5,qwerty,1
Code:
...
List<FooRow> inputList = new ArrayList<FooRow>();
inputList = br.lines().map(mapToFooRow).collect(Collectors.toList());
...
public class FooRow{
private Integer id;
private String name;
private Integer value;
}
I want to create a collectors that return me a list with the count of value grouped by name:
name,value
foo,20
bar,30
qwerty,1
How can I create a class Collectors to do this in the lambda expression? Thanks.