Package co.aikar.util
Class LoadingMap<K,V> 
java.lang.Object
java.util.AbstractMap<K,V>
 
co.aikar.util.LoadingMap<K,V> 
- Type Parameters:
- K- Key
- V- Value
- All Implemented Interfaces:
- Map<K,- V> 
Deprecated, for removal: This API element is subject to removal in a future version.
Allows you to pass a Loader function that when a key is accessed that doesn't exists,
 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.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classDeprecated, for removal: This API element is subject to removal in a future version.Due to java stuff, you will need to cast it to (Function) for some casesNested classes/interfaces inherited from class java.util.AbstractMapAbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> 
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Deprecated, for removal: This API element is subject to removal in a future version.clone()Deprecated, for removal: This API element is subject to removal in a future version.booleancontainsKey(@Nullable Object key) Deprecated, for removal: This API element is subject to removal in a future version.booleancontainsValue(@Nullable Object value) Deprecated, for removal: This API element is subject to removal in a future version.entrySet()Deprecated, for removal: This API element is subject to removal in a future version.booleanDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.inthashCode()Deprecated, for removal: This API element is subject to removal in a future version.booleanisEmpty()Deprecated, for removal: This API element is subject to removal in a future version.keySet()Deprecated, for removal: This API element is subject to removal in a future version.newAutoMap(@NotNull Map<K, V> backingMap, @NotNull Class<? extends V> valueClass) Deprecated, for removal: This API element is subject to removal in a future version.Creates a LoadingMap with an auto instantiating loader.newAutoMap(@NotNull Map<K, V> backingMap, @Nullable Class<? extends K> keyClass, @NotNull Class<? extends V> valueClass) Deprecated, for removal: This API element is subject to removal in a future version.Creates a LoadingMap with an auto instantiating loader.newHashAutoMap(@NotNull Class<? extends V> valueClass) Deprecated, for removal: This API element is subject to removal in a future version.newHashAutoMap(@NotNull Class<? extends V> valueClass, int initialCapacity, float loadFactor) Deprecated, for removal: This API element is subject to removal in a future version.newHashAutoMap(@Nullable Class<? extends K> keyClass, @NotNull Class<? extends V> valueClass) Deprecated, for removal: This API element is subject to removal in a future version.newHashAutoMap(@Nullable Class<? extends K> keyClass, @NotNull Class<? extends V> valueClass, int initialCapacity, float loadFactor) Deprecated, for removal: This API element is subject to removal in a future version.newHashMap(@NotNull Function<K, V> loader) Deprecated, for removal: This API element is subject to removal in a future version.Initializes an auto loading map using a HashMapnewHashMap(@NotNull Function<K, V> loader, int initialCapacity) Deprecated, for removal: This API element is subject to removal in a future version.Initializes an auto loading map using a HashMapnewHashMap(@NotNull Function<K, V> loader, int initialCapacity, float loadFactor) Deprecated, for removal: This API element is subject to removal in a future version.Initializes an auto loading map using a HashMapnewIdentityHashMap(@NotNull Function<K, V> loader) Deprecated, for removal: This API element is subject to removal in a future version.Initializes an auto loading map using an Identity HashMapnewIdentityHashMap(@NotNull Function<K, V> loader, int initialCapacity) Deprecated, for removal: This API element is subject to removal in a future version.Initializes an auto loading map using an Identity HashMapDeprecated, for removal: This API element is subject to removal in a future version.Creates a new LoadingMap with the specified map and loaderDeprecated, for removal: This API element is subject to removal in a future version.voidDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.intsize()Deprecated, for removal: This API element is subject to removal in a future version.values()Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class java.util.AbstractMaptoStringMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Mapcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
- 
Constructor Details- 
LoadingMapDeprecated, for removal: This API element is subject to removal in a future version.Initializes an auto loading map using specified loader and backing map- Parameters:
- backingMap- Map to wrap
- loader- Loader
 
 
- 
- 
Method Details- 
of@NotNull public static <K,V> @NotNull Map<K,V> of(@NotNull @NotNull Map<K, V> backingMap, @NotNull @NotNull Function<K, V> loader) Deprecated, for removal: This API element is subject to removal in a future version.Creates a new LoadingMap with the specified map and loader- Type Parameters:
- K- Key Type of the Map
- V- Value Type of the Map
- Parameters:
- backingMap- Actual map being used.
- loader- Loader to use
- Returns:
- Map
 
- 
newAutoMap@NotNull public static <K,V> @NotNull Map<K,V> newAutoMap(@NotNull @NotNull Map<K, V> backingMap, @Nullable @Nullable Class<? extends K> keyClass, @NotNull @NotNull Class<? extends V> valueClass) Deprecated, for removal: This API element is subject to removal in a future version.Creates a LoadingMap with an auto instantiating loader. Will auto construct class of of Value when not found Since this uses Reflection, It is more effecient to define your own static loader than using this helper, but if performance is not critical, this is easier.- Type Parameters:
- K- Key Type of the Map
- V- Value Type of the Map
- Parameters:
- backingMap- Actual map being used.
- keyClass- Class used for the K generic
- valueClass- Class used for the V generic
- Returns:
- Map that auto instantiates on .get()
 
- 
newAutoMap@NotNull public static <K,V> @NotNull Map<K,V> newAutoMap(@NotNull @NotNull Map<K, V> backingMap, @NotNull @NotNull Class<? extends V> valueClass) Deprecated, for removal: This API element is subject to removal in a future version.Creates a LoadingMap with an auto instantiating loader. Will auto construct class of of Value when not found Since this uses Reflection, It is more effecient to define your own static loader than using this helper, but if performance is not critical, this is easier.- Type Parameters:
- K- Key Type of the Map
- V- Value Type of the Map
- Parameters:
- backingMap- Actual map being used.
- valueClass- Class used for the V generic
- Returns:
- Map that auto instantiates on .get()
 
- 
newHashAutoMap@NotNull public static <K,V> @NotNull Map<K,V> newHashAutoMap(@Nullable @Nullable Class<? extends K> keyClass, @NotNull @NotNull Class<? extends V> valueClass) Deprecated, for removal: This API element is subject to removal in a future version.- Type Parameters:
- K- Key Type of the Map
- V- Value Type of the Map
- Parameters:
- keyClass- Class used for the K generic
- valueClass- Class used for the V generic
- Returns:
- Map that auto instantiates on .get()
- See Also:
 
- 
newHashAutoMap@NotNull public static <K,V> @NotNull Map<K,V> newHashAutoMap(@NotNull @NotNull Class<? extends V> valueClass) Deprecated, for removal: This API element is subject to removal in a future version.- Type Parameters:
- K- Key Type of the Map
- V- Value Type of the Map
- Parameters:
- valueClass- Class used for the V generic
- Returns:
- Map that auto instantiates on .get()
- See Also:
 
- 
newHashAutoMap@NotNull public static <K,V> @NotNull Map<K,V> newHashAutoMap(@Nullable @Nullable Class<? extends K> keyClass, @NotNull @NotNull Class<? extends V> valueClass, int initialCapacity, float loadFactor) Deprecated, for removal: This API element is subject to removal in a future version.- Type Parameters:
- K- Key Type of the Map
- V- Value Type of the Map
- Parameters:
- keyClass- Class used for the K generic
- valueClass- Class used for the V generic
- initialCapacity- Initial capacity to use
- loadFactor- Load factor to use
- Returns:
- Map that auto instantiates on .get()
- See Also:
 
- 
newHashAutoMap@NotNull public static <K,V> @NotNull Map<K,V> newHashAutoMap(@NotNull @NotNull Class<? extends V> valueClass, int initialCapacity, float loadFactor) Deprecated, for removal: This API element is subject to removal in a future version.- Type Parameters:
- K- Key Type of the Map
- V- Value Type of the Map
- Parameters:
- valueClass- Class used for the V generic
- initialCapacity- Initial capacity to use
- loadFactor- Load factor to use
- Returns:
- Map that auto instantiates on .get()
- See Also:
 
- 
newHashMapDeprecated, for removal: This API element is subject to removal in a future version.Initializes an auto loading map using a HashMap- Type Parameters:
- K- Key Type of the Map
- V- Value Type of the Map
- Parameters:
- loader- Loader to use
- Returns:
- Map
 
- 
newHashMap@NotNull public static <K,V> @NotNull Map<K,V> newHashMap(@NotNull @NotNull Function<K, V> loader, int initialCapacity) Deprecated, for removal: This API element is subject to removal in a future version.Initializes an auto loading map using a HashMap- Type Parameters:
- K- Key Type of the Map
- V- Value Type of the Map
- Parameters:
- loader- Loader to use
- initialCapacity- Initial capacity to use
- Returns:
- Map
 
- 
newHashMap@NotNull public static <K,V> @NotNull Map<K,V> newHashMap(@NotNull @NotNull Function<K, V> loader, int initialCapacity, float loadFactor) Deprecated, for removal: This API element is subject to removal in a future version.Initializes an auto loading map using a HashMap- Type Parameters:
- K- Key Type of the Map
- V- Value Type of the Map
- Parameters:
- loader- Loader to use
- initialCapacity- Initial capacity to use
- loadFactor- Load factor to use
- Returns:
- Map
 
- 
newIdentityHashMap@NotNull public static <K,V> @NotNull Map<K,V> newIdentityHashMap(@NotNull @NotNull Function<K, V> loader) Deprecated, for removal: This API element is subject to removal in a future version.Initializes an auto loading map using an Identity HashMap- Type Parameters:
- K- Key Type of the Map
- V- Value Type of the Map
- Parameters:
- loader- Loader to use
- Returns:
- Map
 
- 
newIdentityHashMap@NotNull public static <K,V> @NotNull Map<K,V> newIdentityHashMap(@NotNull @NotNull Function<K, V> loader, int initialCapacity) Deprecated, for removal: This API element is subject to removal in a future version.Initializes an auto loading map using an Identity HashMap- Type Parameters:
- K- Key Type of the Map
- V- Value Type of the Map
- Parameters:
- loader- Loader to use
- initialCapacity- Initial capacity to use
- Returns:
- Map
 
- 
sizepublic int size()Deprecated, for removal: This API element is subject to removal in a future version.
- 
isEmptypublic boolean isEmpty()Deprecated, for removal: This API element is subject to removal in a future version.
- 
containsKeyDeprecated, for removal: This API element is subject to removal in a future version.- Specified by:
- containsKeyin interface- Map<K,- V> 
- Overrides:
- containsKeyin class- AbstractMap<K,- V> 
 
- 
containsValueDeprecated, for removal: This API element is subject to removal in a future version.- Specified by:
- containsValuein interface- Map<K,- V> 
- Overrides:
- containsValuein class- AbstractMap<K,- V> 
 
- 
getDeprecated, for removal: This API element is subject to removal in a future version.
- 
putDeprecated, for removal: This API element is subject to removal in a future version.
- 
removeDeprecated, for removal: This API element is subject to removal in a future version.
- 
putAllDeprecated, for removal: This API element is subject to removal in a future version.
- 
clearpublic void clear()Deprecated, for removal: This API element is subject to removal in a future version.
- 
keySetDeprecated, for removal: This API element is subject to removal in a future version.
- 
valuesDeprecated, for removal: This API element is subject to removal in a future version.
- 
equalsDeprecated, for removal: This API element is subject to removal in a future version.
- 
hashCodepublic int hashCode()Deprecated, for removal: This API element is subject to removal in a future version.
- 
entrySetDeprecated, for removal: This API element is subject to removal in a future version.
- 
cloneDeprecated, for removal: This API element is subject to removal in a future version.- Overrides:
- clonein class- AbstractMap<K,- V> 
 
 
-