Package co.aikar.util
Class LoadingIntMap<V>
java.lang.Object
it.unimi.dsi.fastutil.ints.AbstractInt2ObjectFunction<V>
it.unimi.dsi.fastutil.ints.AbstractInt2ObjectMap<V>
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<V>
co.aikar.util.LoadingIntMap<V>
- Type Parameters:
V
- Value
- All Implemented Interfaces:
it.unimi.dsi.fastutil.Function<Integer,
,V> it.unimi.dsi.fastutil.Hash
,it.unimi.dsi.fastutil.ints.Int2ObjectFunction<V>
,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>
,Serializable
,Cloneable
,Function<Integer,
,V> IntFunction<V>
,Map<Integer,
V>
public class LoadingIntMap<V>
extends it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<V>
Allows you to pass a Loader function that when a key is accessed that doesn't exist,
automatically loads the entry into the map by calling the loader Function.
.get() Will only return null if the Loader can return null.
You may pass any backing Map to use.
This class is not thread safe and should be wrapped with Collections.synchronizedMap on the OUTSIDE of the LoadingMap if needed.
Do not wrap the backing map with Collections.synchronizedMap.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Due to java stuff, you will need to cast it to (Function) for some casesNested classes/interfaces inherited from class it.unimi.dsi.fastutil.ints.AbstractInt2ObjectMap
it.unimi.dsi.fastutil.ints.AbstractInt2ObjectMap.BasicEntry<V extends Object>, it.unimi.dsi.fastutil.ints.AbstractInt2ObjectMap.BasicEntrySet<V extends Object>
Nested classes/interfaces inherited from interface it.unimi.dsi.fastutil.Hash
it.unimi.dsi.fastutil.Hash.Strategy<K extends Object>
-
Field Summary
Fields inherited from class it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
containsNullKey, entries, f, key, keys, mask, maxFill, minN, n, size, value, values
Fields inherited from class it.unimi.dsi.fastutil.ints.AbstractInt2ObjectFunction
defRetValue
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
ConstructorDescriptionLoadingIntMap
(int expectedSize, float loadFactor, @NotNull Function<Integer, V> loader) LoadingIntMap
(int expectedSize, @NotNull Function<Integer, V> loader) LoadingIntMap
(@NotNull Function<Integer, V> loader) -
Method Summary
Methods inherited from class it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, getOrDefault, hashCode, int2ObjectEntrySet, isEmpty, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, shiftKeys, size, trim, trim, values
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractInt2ObjectMap
equals, toString
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractInt2ObjectFunction
defaultReturnValue, defaultReturnValue
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface it.unimi.dsi.fastutil.Function
apply
Methods inherited from interface it.unimi.dsi.fastutil.ints.Int2ObjectFunction
apply
Methods inherited from interface it.unimi.dsi.fastutil.ints.Int2ObjectMap
compute, computeIfAbsent, computeIfAbsentPartial, computeIfPresent, containsKey, defaultReturnValue, defaultReturnValue, entrySet, get, getOrDefault, merge, put, putIfAbsent, remove, remove, replace, replace
Methods inherited from interface java.util.Map
forEach, replaceAll