I have a collection of invoices :
class Invoice { int month; BigDecimal amount }
I\'d like to merge these invoices, so I get one invoice pe
Here is the solution by My library: AbacusUtil
Stream.of(invoices) .groupBy2(Invoice::getMonth, Invoice::getAmount, BigDecimal::add) .map(e -> new Invoice(e.getKey(), e.getValue())) // Probably we should not modify original invoices. create new instances. .toList();