FileDocCategorySizeDatePackage
NumberBox.javaAPI DocExample814Sat May 22 09:00:54 BST 2004com.oreilly.tiger.ch02

NumberBox

public class NumberBox extends Box

Fields Summary
Constructors Summary
public NumberBox()

    super();
  
Methods Summary
public doublesum()

    double total = 0;
    for (Iterator<N> i = contents.iterator(); i.hasNext(); ) {
      total = total + i.next().doubleValue();
    }
    return total;
  
public static doublesum(Box box1, Box box2)

    double total = 0;
    for (Iterator<A> i = box1.contents.iterator(); i.hasNext(); ) {
      total = total + i.next().doubleValue();
    }
    for (Iterator<A> i = box2.contents.iterator(); i.hasNext(); ) {
      total = total + i.next().doubleValue();
    }
    return total;