//  Data Structures with Java by John R. Hubbard
//  Copyright McGraw-Hill, 2001
//  Example 5.5 on page 99
//  A Bag() constructor

  public Bag(Collection collection)
  { // constructs a bag containing the objects in the
    // given collection and with twice the capacity
    objects = new Object[2*collection.size()];
    for (Iterator it = collection.iterator(); it.hasNext(); )
      objects[size++] = it.next();
  }
  