Class FastCopyHashSet<E>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.jboss.modules.FastCopyHashSet<E>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, Set<E>

class FastCopyHashSet<E> extends AbstractSet<E> implements Set<E>, Cloneable, Serializable
A HashSet that is optimized for fast shallow copies. If the copy-ctor is passed another FastCopyHashSet, or clone is called on this set, the shallow copy can be performed using little more than a single array copy. In order to accomplish this, immutable objects must be used internally, so update operations result in slightly more object churn than HashSet.

Note: It is very important to use a smaller load factor than you normally would for HashSet, since the implementation is open-addressed with linear probing. With a 50% load-factor a get is expected to return in only 2 probes. However, a 90% load-factor is expected to return in around 50 probes.