K
- KeyV
- Valuepublic class LoadingMap<K,V> extends AbstractMap<K,V>
Modifier and Type | Class and Description |
---|---|
static class |
LoadingMap.Feeder<T>
Due to java stuff, you will need to cast it to (Function) for some cases
|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
LoadingMap(Map<K,V> backingMap,
Function<K,V> loader)
Initializes an auto loading map using specified loader and backing map
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
LoadingMap<K,V> |
clone() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object o) |
V |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
Set<K> |
keySet() |
static <K,V> Map<K,V> |
newAutoMap(Map<K,V> backingMap,
Class<? extends K> keyClass,
Class<? extends V> valueClass)
Creates a LoadingMap with an auto instantiating loader.
|
static <K,V> Map<K,V> |
newAutoMap(Map<K,V> backingMap,
Class<? extends V> valueClass)
Creates a LoadingMap with an auto instantiating loader.
|
static <K,V> Map<K,V> |
newHashAutoMap(Class<? extends K> keyClass,
Class<? extends V> valueClass) |
static <K,V> Map<K,V> |
newHashAutoMap(Class<? extends K> keyClass,
Class<? extends V> valueClass,
int initialCapacity,
float loadFactor) |
static <K,V> Map<K,V> |
newHashAutoMap(Class<? extends V> valueClass) |
static <K,V> Map<K,V> |
newHashAutoMap(Class<? extends V> valueClass,
int initialCapacity,
float loadFactor) |
static <K,V> Map<K,V> |
newHashMap(Function<K,V> loader)
Initializes an auto loading map using a HashMap
|
static <K,V> Map<K,V> |
newHashMap(Function<K,V> loader,
int initialCapacity)
Initializes an auto loading map using a HashMap
|
static <K,V> Map<K,V> |
newHashMap(Function<K,V> loader,
int initialCapacity,
float loadFactor)
Initializes an auto loading map using a HashMap
|
static <K,V> Map<K,V> |
newIdentityHashMap(Function<K,V> loader)
Initializes an auto loading map using an Identity HashMap
|
static <K,V> Map<K,V> |
newIdentityHashMap(Function<K,V> loader,
int initialCapacity)
Initializes an auto loading map using an Identity HashMap
|
static <K,V> Map<K,V> |
of(Map<K,V> backingMap,
Function<K,V> loader)
Creates a new LoadingMap with the specified map and loader
|
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> m) |
V |
remove(Object key) |
int |
size() |
Collection<V> |
values() |
toString
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
@NotNull public static <K,V> Map<K,V> of(@NotNull Map<K,V> backingMap, @NotNull Function<K,V> loader)
K
- Key Type of the MapV
- Value Type of the MapbackingMap
- Actual map being used.loader
- Loader to use@NotNull public static <K,V> Map<K,V> newAutoMap(@NotNull Map<K,V> backingMap, @Nullable Class<? extends K> keyClass, @NotNull Class<? extends V> valueClass)
K
- Key Type of the MapV
- Value Type of the MapbackingMap
- Actual map being used.keyClass
- Class used for the K genericvalueClass
- Class used for the V generic@NotNull public static <K,V> Map<K,V> newAutoMap(@NotNull Map<K,V> backingMap, @NotNull Class<? extends V> valueClass)
K
- Key Type of the MapV
- Value Type of the MapbackingMap
- Actual map being used.valueClass
- Class used for the V generic@NotNull public static <K,V> Map<K,V> newHashAutoMap(@Nullable Class<? extends K> keyClass, @NotNull Class<? extends V> valueClass)
K
- Key Type of the MapV
- Value Type of the MapkeyClass
- Class used for the K genericvalueClass
- Class used for the V genericnew Auto initializing map using a HashMap.
@NotNull public static <K,V> Map<K,V> newHashAutoMap(@NotNull Class<? extends V> valueClass)
K
- Key Type of the MapV
- Value Type of the MapvalueClass
- Class used for the V genericnew Auto initializing map using a HashMap.
@NotNull public static <K,V> Map<K,V> newHashAutoMap(@Nullable Class<? extends K> keyClass, @NotNull Class<? extends V> valueClass, int initialCapacity, float loadFactor)
K
- Key Type of the MapV
- Value Type of the MapkeyClass
- Class used for the K genericvalueClass
- Class used for the V genericinitialCapacity
- Initial capacity to useloadFactor
- Load factor to usenew Auto initializing map using a HashMap.
@NotNull public static <K,V> Map<K,V> newHashAutoMap(@NotNull Class<? extends V> valueClass, int initialCapacity, float loadFactor)
K
- Key Type of the MapV
- Value Type of the MapvalueClass
- Class used for the V genericinitialCapacity
- Initial capacity to useloadFactor
- Load factor to usenew Auto initializing map using a HashMap.
@NotNull public static <K,V> Map<K,V> newHashMap(@NotNull Function<K,V> loader)
K
- Key Type of the MapV
- Value Type of the Maploader
- Loader to use@NotNull public static <K,V> Map<K,V> newHashMap(@NotNull Function<K,V> loader, int initialCapacity)
K
- Key Type of the MapV
- Value Type of the Maploader
- Loader to useinitialCapacity
- Initial capacity to use@NotNull public static <K,V> Map<K,V> newHashMap(@NotNull Function<K,V> loader, int initialCapacity, float loadFactor)
K
- Key Type of the MapV
- Value Type of the Maploader
- Loader to useinitialCapacity
- Initial capacity to useloadFactor
- Load factor to use@NotNull public static <K,V> Map<K,V> newIdentityHashMap(@NotNull Function<K,V> loader)
K
- Key Type of the MapV
- Value Type of the Maploader
- Loader to use@NotNull public static <K,V> Map<K,V> newIdentityHashMap(@NotNull Function<K,V> loader, int initialCapacity)
K
- Key Type of the MapV
- Value Type of the Maploader
- Loader to useinitialCapacity
- Initial capacity to usepublic int size()
public boolean isEmpty()
public boolean containsKey(@Nullable Object key)
containsKey
in interface Map<K,V>
containsKey
in class AbstractMap<K,V>
public boolean containsValue(@Nullable Object value)
containsValue
in interface Map<K,V>
containsValue
in class AbstractMap<K,V>
public void clear()
@NotNull public Collection<V> values()
public boolean equals(@Nullable Object o)
public int hashCode()
@NotNull public LoadingMap<K,V> clone()
clone
in class AbstractMap<K,V>
Copyright © 2022. All rights reserved.