Top Description Fields Constructors Methods
org.apache.commons.collections4.multiset

public Class HashMultiSet<E>

extends AbstractMapMultiSet<E>
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Type Parameters
<E>
the type held in the multiset
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serializable, java.util.Collection, .HashMap

Implements MultiSet, using a HashMap to provide the data storage. This is the standard implementation of a multiset.

A MultiSet 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.

Since
4.1

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Serial version lock

Constructor Summary

AccessConstructor and Description
public
HashMultiSet()

Constructs an empty HashMultiSet.

public
HashMultiSet(final Collection<? extends E>
a collection to copy into this multiset
coll
)

Constructs a multiset containing all the members of the given collection.

Method Summary

Modifier and TypeMethod and Description
private void
readObject(final ObjectInputStream
the input stream
in
)

Read the multiset in using a custom routine.

private void
writeObject(final ObjectOutputStream
the output stream
out
)

Write the multiset out using a custom routine.

Inherited from org.apache.commons.collections4.multiset.AbstractMapMultiSet:
addclearcontainscreateEntrySetIteratorcreateUniqueSetIteratordoReadObjectdoWriteObjectequalsgetCountgetMaphashCodeisEmptyiteratorremovesetMapsizetoArraytoArrayuniqueElements

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Serial version lock

Constructor Detail

HashMultiSetback to summary
public HashMultiSet()

Constructs an empty HashMultiSet.

HashMultiSetback to summary
public HashMultiSet(final Collection<? extends E> coll)

Constructs a multiset containing all the members of the given collection.

Parameters
coll:Collection<? extends E>

a collection to copy into this multiset

Method Detail

readObjectback to summary
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException

Read the multiset in using a custom routine.

Parameters
in:ObjectInputStream

the input stream

Exceptions
IOException:
if an error occurs while reading from the stream
ClassNotFoundException:
if an object read from the stream can not be loaded
writeObjectback to summary
private void writeObject(final ObjectOutputStream out) throws IOException

Write the multiset out using a custom routine.

Parameters
out:ObjectOutputStream

the output stream

Exceptions
IOException:
if an error occurs while writing to the stream