Class MutableHashedLinkedMap<K,V>
- Type Parameters:
K
- the type of keysV
- the type of mapped values
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
private class
private static class
static interface
-
Field Summary
Modifier and TypeFieldDescriptionstatic final it.unimi.dsi.fastutil.Hash.Strategy
<? super Object> A strategy that usesObjects.hashCode(Object)
andObject.equals(Object)
.private int
private MutableHashedLinkedMap<K,
V>.Entry static final it.unimi.dsi.fastutil.Hash.Strategy
<? super Object> A strategy that usesSystem.identityHashCode(Object)
anda == b
comparisons.private final BiPredicate
<K, V> private MutableHashedLinkedMap<K,
V>.Entry private final MutableHashedLinkedMap.MergeFunction
<K, V> private final it.unimi.dsi.fastutil.Hash.Strategy
<? super K> -
Constructor Summary
ConstructorDescriptionCreates a new instance using theBASIC
strategy.MutableHashedLinkedMap
(it.unimi.dsi.fastutil.Hash.Strategy<? super K> strategy) Creates a mutable linked map with a default new-value-selecting merge function.MutableHashedLinkedMap
(it.unimi.dsi.fastutil.Hash.Strategy<? super K> strategy, BiPredicate<K, V> insertTest) Creates a mutable linked map with a default new-value-selecting merge function.MutableHashedLinkedMap
(it.unimi.dsi.fastutil.Hash.Strategy<? super K> strategy, MutableHashedLinkedMap.MergeFunction<K, V> merge) Creates a mutable linked map with a default new-value-selecting merge function.MutableHashedLinkedMap
(it.unimi.dsi.fastutil.Hash.Strategy<? super K> strategy, MutableHashedLinkedMap.MergeFunction<K, V> merge, BiPredicate<K, V> insertTest) Creates a mutable linked map with a custom merge function. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
isEmpty()
iterator()
Inserts the mapping with the specified key and value pair.Inserts the mapping with this key and value pair immediately after the entry with the specified positioning key.Inserts the mapping with this key and value pair immediately before the entry with the specified positioning key.Inserts the mapping with the specified key and value pair at the beginning of this map.private void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
BASIC
A strategy that usesObjects.hashCode(Object)
andObject.equals(Object)
. -
IDENTITY
A strategy that usesSystem.identityHashCode(Object)
anda == b
comparisons. -
strategy
-
entries
-
merge
-
insertTest
-
head
-
last
-
changes
private transient int changes
-
-
Constructor Details
-
MutableHashedLinkedMap
public MutableHashedLinkedMap()Creates a new instance using theBASIC
strategy. -
MutableHashedLinkedMap
Creates a mutable linked map with a default new-value-selecting merge function.- Parameters:
strategy
- the hashing strategy
-
MutableHashedLinkedMap
public MutableHashedLinkedMap(it.unimi.dsi.fastutil.Hash.Strategy<? super K> strategy, MutableHashedLinkedMap.MergeFunction<K, V> merge) Creates a mutable linked map with a default new-value-selecting merge function.- Parameters:
strategy
- the hashing strategymerge
- the function used when merging an existing value and a new value
-
MutableHashedLinkedMap
public MutableHashedLinkedMap(it.unimi.dsi.fastutil.Hash.Strategy<? super K> strategy, BiPredicate<K, V> insertTest) Creates a mutable linked map with a default new-value-selecting merge function.- Parameters:
strategy
- the hashing strategyinsertTest
- the test to apply before inserting a key and value
-
MutableHashedLinkedMap
public MutableHashedLinkedMap(it.unimi.dsi.fastutil.Hash.Strategy<? super K> strategy, MutableHashedLinkedMap.MergeFunction<K, V> merge, BiPredicate<K, V> insertTest) Creates a mutable linked map with a custom merge function.- Parameters:
strategy
- the hashing strategymerge
- the function used when merging an existing value and a new valueinsertTest
- the test to apply before inserting a key and value
-
-
Method Details
-
put
Inserts the mapping with the specified key and value pair.If there is a mapping already associated with this key, then the previous value and the specified (new) value are merged according to this collection's merge function, and the position of the entry is not modified. If there is no such mapping, then the key-value mapping is inserted at the end of this collection.
- Parameters:
key
- key to be insertedvalue
- (new) value to be associated with the key- Returns:
- the previous value associated with the specified key, or
null
if there was no mapping for the key
-
contains
-
isEmpty
public boolean isEmpty() -
remove
-
get
-
iterator
-
putFirst
Inserts the mapping with the specified key and value pair at the beginning of this map.If there is a mapping already associated with this key, then the previous value and the specified (new) value are first merged according to this map's merge function, then the entry is moved to the beginning of the map.
- Parameters:
key
- key to be inserted at the beginningvalue
- (new) value to be associated with the key- Returns:
- the previous value associated with the specified key, or
null
if there was no mapping for the key - See Also:
-
putAfter
Inserts the mapping with this key and value pair immediately after the entry with the specified positioning key.If the specified positioning key is not present within this map, then this method behaves like
put(Object, Object)
. If there is a mapping already associated with this key, then the previous value and the specified (new) value are first merged according to this map's merge function, then the entry is moved to directly after the entry with the specified positioning key.- Parameters:
after
- the key to position this new entry afterwardskey
- key to be inserted at the beginningvalue
- (new) value to be associated with the key- Returns:
- the previous value associated with the specified key, or
null
if there was no mapping for the key - See Also:
-
putBefore
Inserts the mapping with this key and value pair immediately before the entry with the specified positioning key.If the specified positioning key is not present within this map, then this method behaves like
put(Object, Object)
. If there is a mapping already associated with this key, then the previous value and the specified (new) value are first merged according to this map's merge function, then the entry is moved to directly before the entry with the specified positioning key.- Parameters:
before
- the key to position this new entry afterwardskey
- key to be inserted at the beginningvalue
- (new) value to be associated with the key- Returns:
- the previous value associated with the specified key, or
null
if there was no mapping for the key - See Also:
-
remove
-