/** * Obtains an instance from the specified currency and array of values. * * @param amounts the amounts, one for each scenario * @return an instance with the specified currency and values */ public static MultiCurrencyScenarioArray of(MultiCurrencyAmountArray amounts) { return new MultiCurrencyScenarioArray(amounts); }
@Override public MultiCurrencyScenarioArray build() { return new MultiCurrencyScenarioArray( amounts); }
/** * Returns an instance containing the values from the list of amounts. * * @param amounts the amounts, one for each scenario * @return an instance containing the values from the list of amounts */ public static MultiCurrencyScenarioArray of(List<MultiCurrencyAmount> amounts) { return new MultiCurrencyScenarioArray(MultiCurrencyAmountArray.of(amounts)); }
/** * Returns an instance containing the values from a map of amounts with the same number of elements in each array. * * @param values map of currencies to values * @return an instance containing the values from the map */ public static MultiCurrencyScenarioArray of(Map<Currency, DoubleArray> values) { return new MultiCurrencyScenarioArray(MultiCurrencyAmountArray.of(values)); }
/** * Obtains an instance using a function to create the entries. * <p> * The function is passed the scenario index and returns the value for that index. * * @param size the number of elements * @param amountFunction the function used to obtain each amount * @return an instance initialized using the function * @throws IllegalArgumentException is size is zero or less */ public static MultiCurrencyScenarioArray of(int size, IntFunction<MultiCurrencyAmount> amountFunction) { return new MultiCurrencyScenarioArray(MultiCurrencyAmountArray.of(size, amountFunction)); }