//  Data Structures with Java by John R. Hubbard
//  Copyright McGraw-Hill, 2001
//  Problem 5.9 on page 107

  public boolean removeAll(Collection collection)
  { // removes from this bag all of the object that are also in
    // the given collection, thereby reducing this bag to its
    // set-theoretic intersection with that collection;
    // returns true iff this bag was modified;
    boolean modified=false;
    for (Iterator it = collection.iterator(); it.hasNext(); )
      if (this.remove(it.next())) modified = true;
    return modified;
  }
