public static Collector < MonetaryAmount , ? , Map < CurrencyUnit , List < MonetaryAmount > > > groupByCurrencyUnit ( ) { return Collectors . groupingBy ( MonetaryAmount :: getCurrency ) ; }
Collector to group by CurrencyUnit