Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }