Class InsertableLinkedOpenCustomHashSet<T>
java.lang.Object
java.util.AbstractCollection<T>
it.unimi.dsi.fastutil.objects.AbstractObjectCollection<T>
it.unimi.dsi.fastutil.objects.AbstractObjectSet<T>
it.unimi.dsi.fastutil.objects.AbstractObjectSortedSet<T>
it.unimi.dsi.fastutil.objects.ObjectLinkedOpenCustomHashSet<T>
net.neoforged.neoforge.common.util.InsertableLinkedOpenCustomHashSet<T>
- All Implemented Interfaces:
it.unimi.dsi.fastutil.Hash
,it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterable<T>
,it.unimi.dsi.fastutil.objects.ObjectCollection<T>
,it.unimi.dsi.fastutil.objects.ObjectIterable<T>
,it.unimi.dsi.fastutil.objects.ObjectSet<T>
,it.unimi.dsi.fastutil.objects.ObjectSortedSet<T>
,Serializable
,Cloneable
,Iterable<T>
,Collection<T>
,SequencedCollection<T>
,SequencedSet<T>
,Set<T>
,SortedSet<T>
public class InsertableLinkedOpenCustomHashSet<T>
extends it.unimi.dsi.fastutil.objects.ObjectLinkedOpenCustomHashSet<T>
Special linked hash set that allow changing the order of its entries and is strict to throw if attempting to add an entry that already exists.
Requires a strategy for the hashing behavior. Use
BasicStrategy.BASIC
or IdentityStrategy.IDENTITY
if no special hashing needed.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface it.unimi.dsi.fastutil.Hash
it.unimi.dsi.fastutil.Hash.Strategy<K>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
The number of bits which take up the space for the previous or next position.private static final long
The bitmask for the next element's position.private static final long
The bitmask for the previous element's position.Fields inherited from class it.unimi.dsi.fastutil.objects.ObjectLinkedOpenCustomHashSet
containsNull, f, first, key, last, link, mask, maxFill, minN, n, size, strategy
Fields inherited from interface it.unimi.dsi.fastutil.Hash
DEFAULT_GROWTH_FACTOR, DEFAULT_INITIAL_SIZE, DEFAULT_LOAD_FACTOR, FAST_LOAD_FACTOR, FREE, OCCUPIED, PRIMES, REMOVED, VERY_FAST_LOAD_FACTOR
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newInsertableLinkedOpenCustomHashSet
with aBasicStrategy
.InsertableLinkedOpenCustomHashSet
(it.unimi.dsi.fastutil.Hash.Strategy<? super T> strategy) Constructs a newInsertableLinkedOpenCustomHashSet
with the givenHash.Strategy
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
This method will attempt to addelement
after the given elementinsertAfter
in the set.boolean
This method will attempt to addelement
before the given elementinsertBefore
in the set.void
void
private int
Requires thatexistingElement
exists in the set already.Methods inherited from class it.unimi.dsi.fastutil.objects.ObjectLinkedOpenCustomHashSet
add, addAll, addAndMoveToFirst, addAndMoveToLast, addOrGet, clear, clone, comparator, contains, ensureCapacity, first, fixPointers, fixPointers, forEach, get, hashCode, headSet, isEmpty, iterator, iterator, last, rehash, remove, removeFirst, removeLast, shiftKeys, size, spliterator, strategy, subSet, tailSet, trim, trim
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectSet
equals
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectCollection
toString
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toArray, toArray
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Field Details
-
LINK_BIT_SPACE
private static final long LINK_BIT_SPACEThe number of bits which take up the space for the previous or next position.- See Also:
-
NEXT_LINK
private static final long NEXT_LINKThe bitmask for the next element's position.- See Also:
-
PREV_LINK
private static final long PREV_LINKThe bitmask for the previous element's position.- See Also:
-
-
Constructor Details
-
InsertableLinkedOpenCustomHashSet
public InsertableLinkedOpenCustomHashSet()Constructs a newInsertableLinkedOpenCustomHashSet
with aBasicStrategy
. -
InsertableLinkedOpenCustomHashSet
Constructs a newInsertableLinkedOpenCustomHashSet
with the givenHash.Strategy
.- Parameters:
strategy
- The strategy to use for adding and getting elements from the set.
-
-
Method Details
-
addAfter
This method will attempt to addelement
after the given elementinsertAfter
in the set. If an element matchinginsertAfter
cannot be found with this set'sHash.Strategy
, thenelement
will be added in insertion order. If {#code element} already exists in the set, then the set is not modified.- Parameters:
insertAfter
- The element to insertelement
after.element
- The element to add into this set.- Returns:
true
if the element was added to the set.
-
addBefore
This method will attempt to addelement
before the given elementinsertBefore
in the set. If an element matchinginsertBefore
cannot be found with this set'sHash.Strategy
, thenelement
will be added in insertion order. If {#code element} already exists in the set, then the set is not modified.- Parameters:
insertBefore
- The element to insertelement
before.element
- The element to add into this set.- Returns:
true
if the element was added to the set.
-
addFirst
-
addLast
-
getPos
Requires thatexistingElement
exists in the set already.
-