public static BigMoney total(Iterable<? extends BigMoneyProvider> monies) {
        MoneyUtils.checkNotNull(monies, "Money iterator must not be null");
        Iterator<? extends BigMoneyProvider> it = monies.iterator();
        if (it.hasNext() == false) {
            throw new IllegalArgumentException("Money iterator must not be empty");
        }
        BigMoney total = of(it.next());
        MoneyUtils.checkNotNull(total, "Money iterator must not contain null entries");
        while (it.hasNext()) {
            total = total.plus(it.next());
        }
        return total;
    }
public static BigMoney total ( Iterable < ? extends BigMoneyProvider > monies ) { MoneyUtils . checkNotNull ( monies , "Money iterator must not be null" ) ; Iterator < ? extends BigMoneyProvider > it = monies . iterator ( ) ; if ( it . hasNext ( ) == false ) { throw new IllegalArgumentException ( "Money iterator must not be empty" ) ; } BigMoney total = of ( it . next ( ) ) ; MoneyUtils . checkNotNull ( total , "Money iterator must not contain null entries" ) ; while ( it . hasNext ( ) ) { total = total . plus ( it . next ( ) ) ; } return total ; }
Obtains an instance of {@code BigMoney} as the total value of a collection.
<p>
The iterable must provide at least one monetary value.
Subsequent amounts are added as though using {@link #plus(BigMoneyProvider)}.
All amounts must be in the same currency.

@param monies  the monetary values to total, not empty, no null elements, not null
@return the total, never null
@throws IllegalArgumentException if the iterable is empty
@throws CurrencyMismatchException if the currencies differ