Class ImmutableStrictMap<K,V>
java.lang.Object
com.polarion.alm.shared.api.utils.collections.ImmutableStrictMap<K,V>
- All Implemented Interfaces:
com.google.gwt.user.client.rpc.IsSerializable,ReadOnlyStrictMap<K,,V> Serializable
public final class ImmutableStrictMap<K,V>
extends Object
implements ReadOnlyStrictMap<K,V>, com.google.gwt.user.client.rpc.IsSerializable, Serializable
Map backed by
LinkedHashMap.
"Strict" means that it does not allow null keys, and that all methods use generics unlike for example Map.containsKey(Object)- Since:
- 3.9.0
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasMap()Returns the adapter toMapinterface for use with 3rd party code or standard Java libraries.booleancontainsKey(K key) booleancontainsValue(V value) entrySet()findKeyForValueIfSame(V value) Finds first key for the given value found by iterating over theReadOnlyStrictMap.entrySet(), the value must be the same instance as the one contained in the map, so the equals() is NOT called by this method on the values.booleanisEmpty()keySet()voidintsize()Returns the same instance if the original map is already immutable, otherwise returns new instance containing the same mappings.toMap()Returns new map containing the same mappings, so modifying the returned map does not modify the original map.toString()values()
-
Field Details
-
EMPTY
-
-
Constructor Details
-
ImmutableStrictMap
public ImmutableStrictMap() -
ImmutableStrictMap
-
ImmutableStrictMap
-
ImmutableStrictMap
-
ImmutableStrictMap
-
ImmutableStrictMap
-
ImmutableStrictMap
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceReadOnlyStrictMap<K,V>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceReadOnlyStrictMap<K,V>
-
containsKey
- Specified by:
containsKeyin interfaceReadOnlyStrictMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceReadOnlyStrictMap<K,V>
-
get
- Specified by:
getin interfaceReadOnlyStrictMap<K,V>
-
findKeyForValueIfSame
Description copied from interface:ReadOnlyStrictMapFinds first key for the given value found by iterating over theReadOnlyStrictMap.entrySet(), the value must be the same instance as the one contained in the map, so the equals() is NOT called by this method on the values.- Specified by:
findKeyForValueIfSamein interfaceReadOnlyStrictMap<K,V> - Parameters:
value- - value to be found, it is found only if it is the same instance.- Returns:
- key associated with this value if it was found
-
putAllTo
- Specified by:
putAllToin interfaceReadOnlyStrictMap<K,V>
-
keySet
- Specified by:
keySetin interfaceReadOnlyStrictMap<K,V>
-
values
- Specified by:
valuesin interfaceReadOnlyStrictMap<K,V>
-
entrySet
- Specified by:
entrySetin interfaceReadOnlyStrictMap<K,V>
-
toString
-
toMap
Description copied from interface:ReadOnlyStrictMapReturns new map containing the same mappings, so modifying the returned map does not modify the original map.- Specified by:
toMapin interfaceReadOnlyStrictMap<K,V>
-
asMap
Description copied from interface:ReadOnlyStrictMapReturns the adapter toMapinterface for use with 3rd party code or standard Java libraries. Unlike theReadOnlyStrictMap.toMap()which returns new map containing the same elements, this method returns live "view" of this map instance meaning that changes done to the returned instance are reflected also in the original map. Unless the original map is immutable, in which case all methods modifying the content throwUnsupportedOperationExceptionThe returned map isSerializable- Specified by:
asMapin interfaceReadOnlyStrictMap<K,V>
-
toImmutable
Description copied from interface:ReadOnlyStrictMapReturns the same instance if the original map is already immutable, otherwise returns new instance containing the same mappings.- Specified by:
toImmutablein interfaceReadOnlyStrictMap<K,V>
-