Example #1
0
 /** Return the sum of <code>money</code> */
 public static Money sum(List<Money> money) {
   Money total = Money.dollars(0.00);
   for (Iterator<Money> i = money.iterator(); i.hasNext(); ) {
     total = total.plus(i.next());
   }
   return total;
 }
Example #2
0
 public static Money sum(Collection<Money> monies) {
   // TODO Return Default Currency
   if (monies.isEmpty()) {
     return Money.dollars(0.00);
   }
   Iterator<Money> iterator = monies.iterator();
   Money sum = iterator.next();
   while (iterator.hasNext()) {
     Money each = iterator.next();
     sum = sum.plus(each);
   }
   return sum;
 }