Class StrictMapImpl<K,V>
java.lang.Object
com.polarion.alm.shared.api.utils.collections.StrictMapImpl<K,V>
- All Implemented Interfaces:
com.google.gwt.user.client.rpc.IsSerializable
,ReadOnlyStrictMap<K,
,V> StrictMap<K,
,V> Serializable
public final class StrictMapImpl<K,V>
extends Object
implements StrictMap<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:
-
Constructor Summary
ConstructorDescriptionStrictMapImpl
(ReadOnlyStrictMap<K, V> map) StrictMapImpl
(Map<K, V> map) StrictMapImpl
(K key, V value) StrictMapImpl
(K key1, V value1, K key2, V value2) StrictMapImpl
(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4, K key5, V value5) StrictMapImpl
(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4, K key5, V value5, K key6, V value6) -
Method Summary
Modifier and TypeMethodDescriptionasMap()
Returns the adapter toMap
interface for use with 3rd party code or standard Java libraries.void
clear()
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
putAll
(ReadOnlyStrictMap<? extends K, ? extends V> m) void
void
void
removeValueIfSame
(V value) Removes the first mapping having the same 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.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()
-
Constructor Details
-
StrictMapImpl
public StrictMapImpl() -
StrictMapImpl
-
StrictMapImpl
-
StrictMapImpl
-
StrictMapImpl
-
StrictMapImpl
-
StrictMapImpl
-
StrictMapImpl
public StrictMapImpl(@NotNull K key1, @Nullable V value1, @NotNull K key2, @Nullable V value2, @NotNull K key3, @Nullable V value3, @NotNull K key4, @Nullable V value4, @NotNull K key5, @Nullable V value5, @NotNull K key6, @Nullable V value6) - Since:
- 3.17.2
-
-
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>
-
put
-
remove
-
removeAll
-
removeValueIfSame
Description copied from interface:StrictMap
Removes the first mapping having the same 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. SeeReadOnlyStrictMap.findKeyForValueIfSame(Object)
- Specified by:
removeValueIfSame
in interfaceStrictMap<K,
V> - Parameters:
value
- - value to be removed. It is removed only if it is the same instance.- Returns:
- key associated with this value if it was found
-
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
-
putAll
-
putAllTo
- Specified by:
putAllTo
in interfaceReadOnlyStrictMap<K,
V>
-
clear
public void clear() -
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
-
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>
-
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>
-