Class CodeListSet<E extends CodeList<E>>

Object
AbstractCollection<E>
AbstractSet<E>
CodeListSet<E>
Type Parameters:
E - the type of code list elements in the set.
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, Set<E>, Checked­Container<E>

public class CodeListSet<E extends CodeList<E>> extends AbstractSet<E> implements CheckedContainer<E>, Cloneable, Serializable
A specialized Set implementation for use with Code­List values. All elements in a Code­List­Set are of the same Code­List class, which must be final. Iterators traverse the elements in the order in which the code list constants are declared.

Implementation note

Code­List­Set is implemented internally by bit vectors for compact and efficient storage. All bulk operations (add­All, remove­All, contains­All) are very quick if their argument is also a Code­List­Set instance.

Usage example

The following example creates a set of Axis­Directions for a (x,y,z) coordinate system:
CodeListSet<AxisDirection> codes = new CodeListSet<>(AxisDirection.class);
Collections.addAll(codes, AxisDirection.EAST, AxisDirection.NORTH, AxisDirection.UP),
Since:
0.3
See Also: