JavaMoney/jsr354-api — pull request #36 by otaviojava (2014-08-10 23:18:15+00:00)
Title: create predicate from CurrencyUnit

Create Predicate from CurrencyUnit.
Given:

MonetaryAmount m1 = Money.of(BigDecimal.TEN, BRAZILIAN_REAL);
MonetaryAmount m2 = Money.of(BigDecimal.ZERO, BRAZILIAN_REAL);
MonetaryAmount m3 = Money.of(BigDecimal.ONE, BRAZILIAN_REAL);
MonetaryAmount m4 = Money.of(BigDecimal.valueOf(4L), BRAZILIAN_REAL);
MonetaryAmount 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();

Will possible do:

List collect = stream.filter(MonetaryAmount.filter(DOLLAR)).collect(Collectors.toList());
Map> isDollarMap = stream.collect(Collectors.partitioningBy(MonetaryAmount.filter(DOLLAR)));