Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static List<Payment> groupByCard(List<Payment> payments) {
- return payments.stream()
- .collect(groupingBy(Payment::getCreditCard))
- .values()
- .stream()
- .flatMap(l -> l.stream().reduce(Payment::combine))
- .toList();
- }
Advertisement
Add Comment
Please, Sign In to add comment