### Question:
FunctionUtils { public static Collector<MultiCurrencyAmount, List<MultiCurrencyAmount>, MultiCurrencyScenarioArray> toMultiCurrencyValuesArray() { return Collector.of( ArrayList<MultiCurrencyAmount>::new, (a, b) -> a.add(b), (l, r) -> { l.addAll(r); return l; }, list -> MultiCurrencyScenarioArray.of(list)); } private  FunctionUtils(); static Collector<T, List<T>, ScenarioArray<T>> toScenarioArray(); static Collector<MultiCurrencyAmount, List<MultiCurrencyAmount>, MultiCurrencyScenarioArray> toMultiCurrencyValuesArray(); static Collector<CurrencyAmount, List<CurrencyAmount>, CurrencyScenarioArray> toCurrencyValuesArray(); static Collector<Double, List<Double>, DoubleScenarioArray> toValuesArray(); static void duplicateResult(Measure existingKey, Measure newKey, Map<Measure, Result<?>> mutableMeasureMap);  }### Answer:
@Test public void toMultiCurrencyArray() { List<MultiCurrencyAmount> amounts = 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))); MultiCurrencyScenarioArray expected = MultiCurrencyScenarioArray.of(amounts); MultiCurrencyScenarioArray array = amounts.stream().collect(FunctionUtils.toMultiCurrencyValuesArray()); assertThat(array).isEqualTo(expected); }