K - The 'key' typeV - The 'value' typepublic abstract class Mapping<K,V>
extends java.lang.Object
get(Object) is invoked.
Consequently, in contrast with Map, it has no specific size(), and thus no entrySet(), keySet() and values() set.
Also the modifying operations (put, putAll, remove and clear) are all missing, because a Mapping is not changed
by "putting" key-value-pairs into it.
Actually Map should extend Mapping, but it doesn't - thus there are the asMap() and
Mappings.fromMap(Map) helper methods.
The relationship between Mapping and Map is very much like that between Predicate and
Collection.
When using this type in a variable, parameter or field declaration, never write:
Mapping<key-type, value-type>
, but always:
Mapping<? super key-type, ? extends value-type>
That way many type conversions are possible which otherwise aren't.
| Constructor and Description |
|---|
Mapping() |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<K,V> |
asMap()
|
abstract boolean |
containsKey(java.lang.Object key) |
abstract V |
get(java.lang.Object key) |