Bag, using a HashMap to provide the
data storage. This is the standard implementation of a bag.
A Bag stores each object in the collection together with a
count of occurrences. Extra methods on the interface allow multiple copies
of an object to be added or removed at once. It is important to read the
interface javadoc carefully as several methods violate the
Collection interface specification.
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Serial version lock |
| Access | Constructor and Description |
|---|---|
| public | |
| public | HashBag(final Collection<? extends E>
a collection to copy into this bag coll)Constructs a bag containing all the members of the given collection. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serial version lock | |
| HashBag | back to summary |
|---|---|
| public HashBag() Constructs an empty | |
| HashBag | back to summary |
|---|---|
| public HashBag(final Collection<? extends E> coll) Constructs a bag containing all the members of the given collection.
| |
| readObject | back to summary |
|---|---|
| private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException Read the bag in using a custom routine.
| |
| writeObject | back to summary |
|---|---|
| private void writeObject(final ObjectOutputStream out) throws IOException Write the bag out using a custom routine.
| |