## Class Monies

• All Implemented Interfaces:
`Comparable<Monies>`, `Iterable<Money>`

```public class Monies
extends Object
implements Comparable<Monies>, Iterable<Money>```
Stores multiple monetary values, with one value per currency.
Author:
AO Industries, Inc.
• ### Method Summary

All Methods
Modifier and Type Method Description
`Monies` `add​(Money addend)`
`Monies` `add​(Monies addend)`
`int` `compareTo​(Monies o)`
Compares two `Monies` by comparing each value matched by `Currency`.
`boolean` `equals​(Object o)`
`Money` `get​(Currency currency)`
`Set<Currency>` `getCurrencies()`
`Map<Currency,​Money>` `getMap()`
`Collection<Money>` `getValues()`
`int` `hashCode()`
`boolean` `isEmpty()`
`boolean` `isZero()`
Check if this is empty or all values are zero.
`Iterator<Money>` `iterator()`
`Monies` `multiply​(BigDecimal multiplicand)`
Multiplies without rounding.
`Monies` ```multiply​(BigDecimal multiplicand, RoundingMode roundingMode)```
Multiplies with rounding.
`Monies` `negate()`
Returns with monetary amounts that are the negative of these amounts.
`static Monies` `of()`
`static Monies` `of​(Money money)`
`static Monies` `of​(Money... monies)`
Combines all the provided the money, adding together any that have the same currency.
`static Monies` `of​(Iterable<Money> monies)`
Combines all the provided the money, adding together any that have the same currency.
`Monies` `removeZeros()`
Removes all currencies with a zero monetary value.
`int` `size()`
`Monies` `subtract​(Money subtrahend)`
`Monies` `subtract​(Monies subtrahend)`
`String` `toString()`
Displays as a comma-separated list of `Money.toString()` or `""` for an empty set.
• ### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`
• ### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`
• ### Method Detail

• #### of

`public static Monies of()`
• #### of

`public static Monies of​(Money money)`
• #### of

`public static Monies of​(Money... monies)`
Combines all the provided the money, adding together any that have the same currency.
• #### of

`public static Monies of​(Iterable<Money> monies)`
Combines all the provided the money, adding together any that have the same currency.
• #### equals

`public boolean equals​(Object o)`
Overrides:
`equals` in class `Object`
• #### hashCode

`public int hashCode()`
Overrides:
`hashCode` in class `Object`
• #### compareTo

`public int compareTo​(Monies o)`
Compares two `Monies` by comparing each value matched by `Currency`. During comparison, any currency not set is handled as zero.

Two `Monies` are not comparable when they have a conflict where one currency is higher and a different currency is lower.

Specified by:
`compareTo` in interface `Comparable<Monies>`
• #### iterator

`public Iterator<Money> iterator()`
Specified by:
`iterator` in interface `Iterable<Money>`
• #### get

`public Money get​(Currency currency)`
• #### getMap

`public Map<Currency,​Money> getMap()`
• #### isEmpty

`public boolean isEmpty()`
• #### size

`public int size()`
• #### getCurrencies

`public Set<Currency> getCurrencies()`
• #### getValues

`public Collection<Money> getValues()`
• #### multiply

```public Monies multiply​(BigDecimal multiplicand)
throws ArithmeticException```
Multiplies without rounding.
Throws:
`ArithmeticException`
`Money.multiply(java.math.BigDecimal)`
• #### negate

`public Monies negate()`
Returns with monetary amounts that are the negative of these amounts.
`Money.negate()`
`public boolean isZero()`
`public Monies removeZeros()`