/** * Returns the greater of two {@code MonetaryAmount} values. If the arguments have the same value, * the result is that same value. * * @param a an argument. * @param b another argument. * @return the larger of {@code a} and {@code b}. */ static MonetaryAmount max(MonetaryAmount a, MonetaryAmount b) { MoneyUtils.checkAmountParameter( Objects.requireNonNull(a), Objects.requireNonNull(b.getCurrency())); return a.isGreaterThan(b) ? a : b; }
/** * Adds two monetary together * * @param a the first operand * @param b the second operand * @return the sum of {@code a} and {@code b} * @throws NullPointerException if a o b be null * @throws MonetaryException if a and b have different currency */ public static MonetaryAmount sum(MonetaryAmount a, MonetaryAmount b) { MoneyUtils.checkAmountParameter( Objects.requireNonNull(a), Objects.requireNonNull(b.getCurrency())); return a.add(b); }