Class ArraySortedSet<E>

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

public class ArraySortedSet<E> extends AbstractSet<E> implements SortedSet<E>, Serializable
A compact SortedSet implementation that stores the elements in order. The emphasis is to use as little heap space as possible - this is not a general-purpose SortedSet 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.

Creation of a set for an already sorted set is O(n) compared to TreeSet's O(n log n). Other operations perform at O(log n) with times very similar to TreeSet.

This set is not thread safe.

Author:
AO Industries, Inc.
See Also: