Class ArraySet<E>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
com.aoapps.collections.ArraySet<E>
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, Set<E>

public class ArraySet<E> extends AbstractSet<E> implements Serializable

A compact Set implementation that stores the elements in hashCode order. The emphasis is to use as little heap space as possible - this is not a general-purpose Set implementation as it has specific constraints about the order elements may be added or removed. To avoid the possibility of O(n^2) behavior, the elements must already be sorted and be added in ascending order. Also, only the last element may be removed.

This set does not support null values.

This set will generally operate at O(log n) due to binary search. In general, it will not be as fast as the O(1) behavior of HashSet. Here we give up speed to save space.

This set is not thread safe.

Author:
AO Industries, Inc.
See Also: