/** * Returns a stream of {@link MultiCurrencyAmount} instances containing the values from this object. * <p> * This method is not very efficient for large sizes as a new object must be created for each value. * Consider using {@link #getValues(Currency)} instead. * * @return a stream of multi currency amounts containing the currency values from this object */ @Override public Stream<MultiCurrencyAmount> stream() { return amounts.stream(); }
public void test_stream() { List<MultiCurrencyAmount> expected = ImmutableList.of( MultiCurrencyAmount.of( CurrencyAmount.of(Currency.GBP, 20), CurrencyAmount.of(Currency.USD, 30), CurrencyAmount.of(Currency.EUR, 40)), MultiCurrencyAmount.of( CurrencyAmount.of(Currency.GBP, 21), CurrencyAmount.of(Currency.USD, 32), CurrencyAmount.of(Currency.EUR, 43)), MultiCurrencyAmount.of( CurrencyAmount.of(Currency.GBP, 22), CurrencyAmount.of(Currency.USD, 33), CurrencyAmount.of(Currency.EUR, 44))); assertThat(VALUES_ARRAY.stream().collect(toList())).isEqualTo(expected); }