- All Implemented Interfaces:
Bagclass represents a bag (or multiset) of generic items. It supports insertion and iterating over the items in arbitrary order.
The add, isEmpty, and size operation take constant time. Iteration takes time proportional to the number of items.
For additional documentation, see Section 1.3 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
Bagpublic Bag()Create an empty stack.