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 longThe number of bits which take up the space for the previous or next position.private static final longThe bitmask for the next element's position.private static final longThe 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, strategyFields 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 newInsertableLinkedOpenCustomHashSetwith aBasicStrategy.InsertableLinkedOpenCustomHashSet(it.unimi.dsi.fastutil.Hash.Strategy<? super T> strategy) Constructs a newInsertableLinkedOpenCustomHashSetwith the givenHash.Strategy. -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis method will attempt to addelementafter the given elementinsertAfterin the set.booleanThis method will attempt to addelementbefore the given elementinsertBeforein the set.voidvoidprivate intRequires thatexistingElementexists 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, trimMethods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectSet
equalsMethods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectCollection
toStringMethods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 newInsertableLinkedOpenCustomHashSetwith aBasicStrategy. -
InsertableLinkedOpenCustomHashSet
Constructs a newInsertableLinkedOpenCustomHashSetwith 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 addelementafter the given elementinsertAfterin the set. If an element matchinginsertAftercannot be found with this set'sHash.Strategy, thenelementwill be added in insertion order. If {#code element} already exists in the set, then the set is not modified.- Parameters:
insertAfter- The element to insertelementafter.element- The element to add into this set.- Returns:
trueif the element was added to the set.
-
addBefore
This method will attempt to addelementbefore the given elementinsertBeforein the set. If an element matchinginsertBeforecannot be found with this set'sHash.Strategy, thenelementwill be added in insertion order. If {#code element} already exists in the set, then the set is not modified.- Parameters:
insertBefore- The element to insertelementbefore.element- The element to add into this set.- Returns:
trueif the element was added to the set.
-
addFirst
-
addLast
-
getPos
Requires thatexistingElementexists in the set already.
-