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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasMap()
Returns the adapter toMap
interface for use with 3rd party code or standard Java libraries.boolean
containsKey
(K key) boolean
containsValue
(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.boolean
isEmpty()
keySet()
void
int
size()
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:
size
in interfaceReadOnlyStrictMap<K,
V>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceReadOnlyStrictMap<K,
V>
-
containsKey
- Specified by:
containsKey
in interfaceReadOnlyStrictMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceReadOnlyStrictMap<K,
V>
-
get
- Specified by:
get
in interfaceReadOnlyStrictMap<K,
V>
-
findKeyForValueIfSame
Description copied from interface:ReadOnlyStrictMap
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.- Specified by:
findKeyForValueIfSame
in 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:
putAllTo
in interfaceReadOnlyStrictMap<K,
V>
-
keySet
- Specified by:
keySet
in interfaceReadOnlyStrictMap<K,
V>
-
values
- Specified by:
values
in interfaceReadOnlyStrictMap<K,
V>
-
entrySet
- Specified by:
entrySet
in interfaceReadOnlyStrictMap<K,
V>
-
toString
-
toMap
Description copied from interface:ReadOnlyStrictMap
Returns new map containing the same mappings, so modifying the returned map does not modify the original map.- Specified by:
toMap
in interfaceReadOnlyStrictMap<K,
V>
-
asMap
Description copied from interface:ReadOnlyStrictMap
Returns the adapter toMap
interface 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 throwUnsupportedOperationException
The returned map isSerializable
- Specified by:
asMap
in interfaceReadOnlyStrictMap<K,
V>
-
toImmutable
Description copied from interface:ReadOnlyStrictMap
Returns the same instance if the original map is already immutable, otherwise returns new instance containing the same mappings.- Specified by:
toImmutable
in interfaceReadOnlyStrictMap<K,
V>
-