JavaMoney/jsr354-ri — pull request #35 by otaviojava (2014-08-10 22:47:03+00:00)
Title: Money lambda

Create three new methods useful to use alone, but to use with stream.
Given:

Money m1 = Money.of(BigDecimal.TEN, BRAZILIAN_REAL);
Money m2 = Money.of(BigDecimal.ZERO, BRAZILIAN_REAL);
Money m3 = Money.of(BigDecimal.ONE, BRAZILIAN_REAL);
Money m4 = Money.of(BigDecimal.valueOf(4L), BRAZILIAN_REAL);
Money m5 = Money.of(BigDecimal.valueOf(5L), BRAZILIAN_REAL);

Stream stream = Stream.of(m1, m2, m3, m4, m5);
or
List list = Arrays.asList(m1, m2, m3, m4, m5);
Stream stream = list.stream();

Is possible:

Money max = stream.reduce(Money::max).get();//should return 10
Money min = stream.reduce(Money::min).get();//should return 0
Money sum = stream.reduce(Money::sum).get();//should return 20

or
MonetaryAmount max = stream.reduce(Money::max).get();//should return 10
…

Next step would be do the same to another implementations of MonetaryAmount.