public class TypeMap extends ConcurrentHashMap<Object,Object>
ConcurrentHashMap.KeySetView<K,V>AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
TypeMap()
Default constructor for creating an empty TypeMap.
|
TypeMap(Map map)
Constructs a new TypeMap with the same mappings as the specified map.
|
| Modifier and Type | Method and Description |
|---|---|
<T> Optional<T> |
get(Object key,
Class<T> type)
Retrieves the value to which the specified key is mapped, and attempts to
convert it to the specified type.
|
<T extends Collection<E>,E> |
get(Object key,
Supplier<? extends T> output,
Class<E> itemType)
Retrieves a collection associated with the specified key and converts it to
the specified collection type and element type.
|
<K,V,M extends Map<K,V>> |
get(Object key,
Supplier<M> output,
Class<K> keyType,
Class<V> valueType)
Retrieves a map of a specific type associated with the specified key.
|
<E> E[] |
getArray(Object key,
E[] typeIndicator,
Class<E> componentType)
Retrieves an array of a specific type associated with the specified key.
|
<E> E[] |
getArray(Object key,
IntFunction<E[]> generator,
Class<E> componentType)
Retrieves an array of a specific type associated with the specified key.
|
TypeMap |
put(Object key,
Object value)
Associates the specified value with the specified key in this map.
|
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, valuesclonepublic TypeMap()
public TypeMap(Map map)
map - The initial map to copy mappings from, can be null.public TypeMap put(Object key, Object value)
public <T> Optional<T> get(Object key, Class<T> type)
T - The target type for conversion.key - the key whose associated value is to be returned.type - the Class object of the type to convert to.public <T extends Collection<E>,E> T get(Object key, Supplier<? extends T> output, Class<E> itemType)
T - The type of the collection to be returned.E - The type of elements in the collection.key - The key whose associated value is to be returned.output - The supplier providing a new collection instance.itemType - The class of the items in the collection.public <E> E[] getArray(Object key, E[] typeIndicator, Class<E> componentType)
E - The component type of the array.key - The key whose associated value is to be returned.typeIndicator - An array instance indicating the type of array to return.componentType - The class of the array's component type.public <E> E[] getArray(Object key, IntFunction<E[]> generator, Class<E> componentType)
E - The component type of the array.key - The key whose associated value is to be returned.generator - A function to generate the array of the required size.componentType - The class of the array's component type.public <K,V,M extends Map<K,V>> M get(Object key, Supplier<M> output, Class<K> keyType, Class<V> valueType)
K - The type of keys in the returned map.V - The type of values in the returned map.M - The type of the map to be returned.key - The key whose associated value is to be returned.output - A supplier providing a new map instance.keyType - The class of the map's key type.valueType - The class of the map's value type.Copyright © 2023. All rights reserved.