Package org.apache.sis.util.collection
Class DerivedMap.Invertible<SK,SV,K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.apache.sis.util.collection.DerivedMap<SK,SV,K,V>
org.apache.sis.util.collection.DerivedMap.InvertibleKey<SK,SV,K,V>
org.apache.sis.util.collection.DerivedMap.Invertible<SK,SV,K,V>
- Type Parameters:
SK
- the type of keys in the storage map.SV
- the type of values in the storage map.K
- the type of keys in this map.V
- the type of values in this map.
- All Implemented Interfaces:
Serializable
,Function<Map.Entry<SK,
,SV>, Map.Entry<K, V>> Map<K,
,V> ObjectConverter<Map.Entry<SK,
SV>, Map.Entry<K, V>>
- Enclosing class:
- DerivedMap<SK,
SV, K, V>
private static final class DerivedMap.Invertible<SK,SV,K,V>
extends DerivedMap.InvertibleKey<SK,SV,K,V>
A
DerivedMap
used when both the DerivedMap.keyConverter
and DerivedMap.valueConverter
are invertible. Availability of the inverse conversion allows us to delegate some operations
to the DerivedMap.storage map instead of iterating over all entries.-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionThe inverse of this entry converter.private static final long
private final ObjectConverter<V,
SV> The inverse ofDerivedMap.valueConverter
.Fields inherited from class org.apache.sis.util.collection.DerivedMap.InvertibleKey
keyInverse
Fields inherited from class org.apache.sis.util.collection.DerivedMap
keyConverter, storage, valueConverter
-
Constructor Summary
ConstructorsConstructorDescriptionInvertible
(Map<SK, SV> storage, ObjectConverter<SK, K> keyConverter, ObjectConverter<SV, V> valueConverter) -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsValue
(Object value) inverse()
To be defined in theDerivedMap.Invertible
sub-class only.Associates the specified value with the specified key in this map.Methods inherited from class org.apache.sis.util.collection.DerivedMap.InvertibleKey
containsKey, get, remove
Methods inherited from class org.apache.sis.util.collection.DerivedMap
apply, create, entrySet, getSourceClass, getTargetClass, isEmpty, keySet, properties, put, size
Methods inherited from class java.util.AbstractMap
clear, clone, equals, hashCode, putAll, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
valueInverse
The inverse ofDerivedMap.valueConverter
. -
inverse
The inverse of this entry converter.
-
-
Constructor Details
-
Invertible
Invertible(Map<SK, SV> storage, ObjectConverter<SK, K> keyConverter, ObjectConverter<SV, V> valueConverter)
-
-
Method Details
-
containsValue
- Specified by:
containsValue
in interfaceMap<SK,
SV> - Overrides:
containsValue
in classAbstractMap<K,
V>
-
put
Description copied from class:DerivedMap
Associates the specified value with the specified key in this map.- Specified by:
put
in interfaceMap<SK,
SV> - Overrides:
put
in classDerivedMap<SK,
SV, K, V> - Parameters:
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.- Returns:
- previous value associated with specified key, or
null
if there was no mapping for key.
-
inverse
Description copied from class:DerivedMap
To be defined in theDerivedMap.Invertible
sub-class only.- Specified by:
inverse
in interfaceObjectConverter<SK,
SV> - Overrides:
inverse
in classDerivedMap<SK,
SV, K, V> - Returns:
- a converter for converting instances of T back to instances of S.
- See Also:
-