Java8Stream

1
2
3
4
5
List<Vo> results = voList.stream().collect(Collectors.groupingBy(this::fetchKey)).values()
.stream().map(vo -> vo.stream().reduce((vo1, vo2) -> {
vo1.setCount(vo1.getCount() + vo2.getCount());
return vo1;
}).orElse(new Vo())).collect(Collectors.toList());