| Modifier and Type | Class and Description |
|---|---|
static class |
Mapping.Builder<K,V,M extends Map<K,V>>
Builder implementation to build target instances of
Map. |
static class |
Mapping.Charger<K,V,M extends Map<K,V>>
Charger implementation to charge target instances of
Map. |
static interface |
Mapping.Setup<K,V,M extends Map<K,V>,S extends Mapping.Setup<K,V,M,S>>
Utility interface to set up a target instance of
Map. |
| Modifier and Type | Method and Description |
|---|---|
static <K,V,M extends Map<K,V>> |
builder(Supplier<M> newTarget)
Returns a new
Mapping.Builder for target instances as supplied by the given Supplier. |
static <K,V,M extends Map<K,V>> |
charger(M target)
Returns a new
Mapping.Charger for a given target instance. |
static <M extends Map<?,?>> |
clear(M subject)
Just like
subject.clear() for a given subject
but returns the subject. |
static boolean |
containsKey(Map<?,?> subject,
Object key)
Just like
Map.containsKey(Object) for a given subject. |
static boolean |
containsValue(Map<?,?> subject,
Object value)
Just like
Map.containsValue(Object) for a given subject. |
static <V> V |
get(Map<?,V> subject,
Object key)
Just like
Map.get(Object) for a given subject. |
static <K,V> Map<K,V> |
proxy(Map<K,V> subject)
Supplies a proxy for a given
subject that may be used to implement some Map-specific
methods, e.g.:
Object.toString()
Map.equals(Object)
Map.hashCode()
... |
static <K,V,M extends Map<K,V>> |
put(M subject,
K key,
V value)
Just like
subject.put(key, value) for a given subject,
but returns the subject. |
static <K,V,M extends Map<? super K,? super V>> |
putAll(M subject,
Map<? extends K,? extends V> origin)
Just like
subject.putAll(origin) for a given subject,
but returns the subject. |
static <M extends Map<?,?>> |
remove(M subject,
Object key)
Just like
subject.remove(key) for a given subject
but returns the subject. |
public static <K,V,M extends Map<K,V>> M put(M subject, K key, V value)
subject.put(key, value) for a given subject,
but returns the subject.UnsupportedOperationException - if Map.put(Object, Object) is not supported by the
subject.NullPointerException - if subject is null or ...NullPointerException - if the specified key or value is null
and the subject does not permit null
keys or valuesClassCastException - if the class of the specified key or value prevents it
from being put into the subject
(may occur only if used raw or forced in a mismatched class context).IllegalArgumentException - if some property of the specified key or value prevents
it from being stored in the subject.Map.put(Object, Object)public static <K,V,M extends Map<? super K,? super V>> M putAll(M subject, Map<? extends K,? extends V> origin)
subject.putAll(origin) for a given subject,
but returns the subject.UnsupportedOperationException - if Map.putAll(Map) is not supported by the subject.NullPointerException - if subject or origin is null or ...NullPointerException - if any of the specified keys or values are
null and the subject does not permit null
keys or values.ClassCastException - if the class of any specified key or value prevents it
from being put into the subject
(may occur only if used raw or forced in a mismatched class context).IllegalArgumentException - if some property of any key or value in the specified
origin prevents it from being stored in the subject.Map.putAll(Map)public static <M extends Map<?,?>> M clear(M subject)
subject.clear() for a given subject
but returns the subject.UnsupportedOperationException - if Collection.clear() is not supported by the subject.NullPointerException - if subject is null.Map.clear()public static <M extends Map<?,?>> M remove(M subject, Object key)
subject.remove(key) for a given subject
but returns the subject.
Avoids an unnecessary ClassCastException or NullPointerException which might be caused by
Map.remove(Object) when the subject does not support the requested key.
UnsupportedOperationException - if Map.remove(Object) is not supported by the subject.NullPointerException - if subject is null.public static boolean containsKey(Map<?,?> subject, Object key)
Map.containsKey(Object) for a given subject.
Avoids an unnecessary ClassCastException or NullPointerException which might be caused by
Map.containsKey(Object) when the subject does not support the requested key.
NullPointerException - if subject is null.public static boolean containsValue(Map<?,?> subject, Object value)
Map.containsValue(Object) for a given subject.
Avoids an unnecessary ClassCastException or NullPointerException which might be caused by
Map.containsValue(Object) when the subject does not support the requested value.
NullPointerException - if subject is null.public static <V> V get(Map<?,V> subject, Object key)
Map.get(Object) for a given subject.
Avoids an unnecessary ClassCastException or NullPointerException which might be caused by
Map.get(Object) when the subject does not support the requested key.
null if the subject doesn't contain (an entry for) the key.NullPointerException - if subject is null.public static <K,V> Map<K,V> proxy(Map<K,V> subject)
subject - A Map, that at least provides independently ...
public static <K,V,M extends Map<K,V>> Mapping.Builder<K,V,M> builder(Supplier<M> newTarget)
Mapping.Builder for target instances as supplied by the given Supplier.K - The key type of the target instance.V - The value type of the target instance.M - The final type of the target instance, at least Map.public static <K,V,M extends Map<K,V>> Mapping.Charger<K,V,M> charger(M target)
Mapping.Charger for a given target instance.K - The key type of the target instance.V - The value type of the target instance.M - The final type of the target instance, at least Map.Copyright © 2023 Andreas Kluge-Kaindl, Bremen (de). All rights reserved.