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 longprivate final ObjectConverter<V,SV> The inverse ofDerivedMap.valueConverter.Fields inherited from class org.apache.sis.util.collection.DerivedMap.InvertibleKey
keyInverseFields 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 TypeMethodDescriptionbooleancontainsValue(Object value) inverse()To be defined in theDerivedMap.Invertiblesub-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, removeMethods inherited from class org.apache.sis.util.collection.DerivedMap
apply, create, entrySet, getSourceClass, getTargetClass, isEmpty, keySet, properties, put, sizeMethods inherited from class java.util.AbstractMap
clear, clone, equals, hashCode, putAll, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
containsValuein interfaceMap<SK,SV> - Overrides:
containsValuein classAbstractMap<K,V>
-
put
Description copied from class:DerivedMapAssociates the specified value with the specified key in this map.- Specified by:
putin interfaceMap<SK,SV> - Overrides:
putin 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
nullif there was no mapping for key.
-
inverse
Description copied from class:DerivedMapTo be defined in theDerivedMap.Invertiblesub-class only.- Specified by:
inversein interfaceObjectConverter<SK,SV> - Overrides:
inversein classDerivedMap<SK,SV, K, V> - Returns:
- a converter for converting instances of T back to instances of S.
- See Also:
-