예제 #1
0
        /// <summary>
        /// Applies an operation to the amounts.
        /// <para>
        /// This is generally used to apply a mathematical operation to the amounts.
        /// For example, the operator could multiply the amounts by a constant, or take the inverse.
        /// <pre>
        ///   multiplied = base.mapAmount(value -> value * 3);
        /// </pre>
        ///
        /// </para>
        /// </summary>
        /// <param name="mapper">  the operator to be applied to the amounts </param>
        /// <returns> a copy of this amount with the mapping applied to the original amounts </returns>
        public MultiCurrencyAmount mapAmounts(System.Func <double, double> mapper)
        {
            ArgChecker.notNull(mapper, "mapper");
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            return(amounts.Select(ca => ca.mapAmount(mapper)).collect(MultiCurrencyAmount.collectorInternal()));
        }
예제 #2
0
 /// <summary>
 /// Obtains an instance from a map of currency to amount.
 /// </summary>
 /// <param name="map">  the map of currency to amount </param>
 /// <returns> the amount </returns>
 public static MultiCurrencyAmount of(IDictionary <Currency, double> map)
 {
     ArgChecker.noNulls(map, "map");
     return(MapStream.of(map).map(CurrencyAmount.of).collect(MultiCurrencyAmount.collectorInternal()));
 }