Package org.plumelib.util
Class UnmodifiableIdentityHashMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.IdentityHashMap<K,V>
org.plumelib.util.UnmodifiableIdentityHashMap<K,V>
- Type Parameters:
K
- the type of keys of the mapV
- the type of values of the map
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<K,
V>
A wrapper around an
IdentityHashMap
that makes it unmodifiable. All mutating operations
throw UnsupportedOperationException
, and all other operations delegate to the underlying
map.
This class extends IdentityHashMap
only so it is assignable to variables / fields of
static type IdentityHashMap
. All valid operations are delegated to the wrapped map, and
any inherited state from the superclass is unused.
- See Also:
-
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> -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
@PolyNull V
@PolyNull V
computeIfAbsent
(K key, Function<? super K, ? extends @PolyNull V> mappingFunction) @PolyNull V
computeIfPresent
(K key, BiFunction<? super K, ? super V, ? extends @PolyNull V> remappingFunction) boolean
containsKey
(@GuardSatisfied @Nullable @UnknownSignedness Object key) boolean
containsValue
(@GuardSatisfied @Nullable @UnknownSignedness Object value) entrySet()
boolean
void
forEach
(BiConsumer<? super K, ? super V> action) @Nullable V
getOrDefault
(@GuardSatisfied @UnknownSignedness Object key, V defaultValue) int
hashCode()
boolean
isEmpty()
keySet()
@PolyNull V
@Nullable V
void
putIfAbsent
(K key, V value) @Nullable V
boolean
remove
(@GuardSatisfied @UnknownSignedness Object key, @GuardSatisfied @UnknownSignedness Object value) boolean
void
replaceAll
(BiFunction<? super K, ? super V, ? extends V> function) @org.checkerframework.checker.index.qual.NonNegative int
size()
toString()
values()
static <K,
V> UnmodifiableIdentityHashMap<K, V> wrap
(IdentityHashMap<K, V> map) Create anUnmodifiableIdentityHashMap
wrapper for a map.Methods inherited from class java.util.IdentityHashMap
clone
-
Method Details
-
wrap
Create anUnmodifiableIdentityHashMap
wrapper for a map. Returns the argument if it is already anUnmodifiableIdentityHashMap
.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
- the map to wrap- Returns:
- the wrapper
-
size
public @org.checkerframework.checker.index.qual.NonNegative int size(@GuardSatisfied UnmodifiableIdentityHashMap<K, V> this) -
isEmpty
public boolean isEmpty(@GuardSatisfied UnmodifiableIdentityHashMap<K, V> this) -
get
-
containsKey
public boolean containsKey(@GuardSatisfied UnmodifiableIdentityHashMap<K, V> this, @GuardSatisfied @Nullable @UnknownSignedness Object key) - Specified by:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classIdentityHashMap<K,
V>
-
containsValue
public boolean containsValue(@GuardSatisfied UnmodifiableIdentityHashMap<K, V> this, @GuardSatisfied @Nullable @UnknownSignedness Object value) - Specified by:
containsValue
in interfaceMap<K,
V> - Overrides:
containsValue
in classIdentityHashMap<K,
V>
-
put
-
putAll
-
remove
-
clear
public void clear(@GuardSatisfied UnmodifiableIdentityHashMap<K, V> this) -
equals
public boolean equals(@GuardSatisfied UnmodifiableIdentityHashMap<K, V> this, @Nullable @GuardSatisfied Object o) -
hashCode
public int hashCode(@GuardSatisfied UnmodifiableIdentityHashMap<K, V> this) -
keySet
-
values
-
entrySet
-
forEach
-
replaceAll
- Specified by:
replaceAll
in interfaceMap<K,
V> - Overrides:
replaceAll
in classIdentityHashMap<K,
V>
-
toString
- Overrides:
toString
in classAbstractMap<K,
V>
-
getOrDefault
-
putIfAbsent
-
remove
-
replace
-
replace
-
computeIfAbsent
-
computeIfPresent
-
compute
-
merge
-