public class EnumOrderedSet<K extends java.lang.Enum<?>> extends OrderedSet<K>
OrderedSet
, it gets features not present in normal JDK Sets, such as retrieval of random
items with OrderedSet.randomItem(IRNG)
, iteration in insertion order instead of always using enum declaration order
(order can be shuffled with OrderedSet.shuffle(IRNG)
or reordered with OrderedSet.reorder(int...)
), and a little more. The
implementation is nearly trivial due to how OrderedMap allows customization of hashing strategy with its IHasher
option, and this class always uses a specific custom IHasher to hash Enum values by their ordinal. This IHasher is
shared with EnumOrderedMap
.
containsNull, DEFAULT_INITIAL_SIZE, DEFAULT_LOAD_FACTOR, f, FAST_LOAD_FACTOR, hasher, key, mask, maxFill, n, order, size, VERY_FAST_LOAD_FACTOR
Constructor and Description |
---|
EnumOrderedSet() |
EnumOrderedSet(java.lang.Class<K> enumClass) |
EnumOrderedSet(K enumObject) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
toString() |
add, addAll, addAll, addAndMoveToFirst, addAndMoveToLast, addAt, addOrGet, alter, alterAt, arraySize, clear, clone, comparator, contains, containsAll, equals, first, fixOrder, fixOrder, get, getAt, hash64, hashCode, headSet, indexOf, isEmpty, iterator, last, maxFill, maxFill, positionOf, randomItem, rehash, rem, remove, removeAll, removeAt, removeFirst, removeLast, reorder, retainAll, reverse, shiftKeys, shuffle, size, sort, sort, subSet, swap, swapIndices, tailSet, toArray, toArray, trim, trim
public EnumOrderedSet()
public EnumOrderedSet(java.lang.Class<K> enumClass)
public EnumOrderedSet(K enumObject)
public java.lang.String toString()
toString
in class OrderedSet<K extends java.lang.Enum<?>>
Copyright © Eben Howard 2012–2022. All rights reserved.