Class ArraySet<E>

  • All Implemented Interfaces:
    Serializable, Iterable<E>, Collection<E>, Set<E>

    public class ArraySet<E>
    extends Object
    implements Set<E>, Serializable

    A Set which is backed by a simple array of elements. This provides all the behaviors of a set backed by an array, thus insert and remove operations are always O(n) time to check for uniqueness. This should only be used for sets which are known to be mostly empty or to contain only a handful of elements.

    The primary use of this set is for those cases where small sets exists and will not be changed. The savings in memory is significant compared to hash sets which may contain many empty buckets.

    Author:
    David Allen
    See Also:
    Serialized Form