K
- the type of keys in this mapV
- the type of values in this mappublic abstract class ProxiedMap<K,V> extends Object implements Map<K,V>
Map
implementation pointing to a given map object.
Therefore it allows implementing maps based on invisible map types, such as
Collections.unmodifiableMap(Map)
or
Collections.synchronizedMap(Map)
.
Constructor and Description |
---|
ProxiedMap(Map<K,V> map)
Creates a new
ProxiedMap instance. |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object object) |
V |
get(Object key) |
protected Map<K,V> |
getProxiedForRead()
Returns the wrapped map without verifying if modifying it is prohibited.
|
protected Map<K,V> |
getProxiedIfModifiable()
Verifies if this object is modifiable and either returns the wrapped map or
throws an appropriate exception.
|
int |
hashCode() |
boolean |
isEmpty() |
abstract boolean |
isModifiable()
Flag specifying if this instance can be modified
|
Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> map) |
V |
remove(Object key) |
int |
size() |
String |
toString() |
Collection<V> |
values() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public boolean containsKey(@Nullable Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(@Nullable Object value)
containsValue
in interface Map<K,V>
public boolean equals(@CheckForNull Object object)
protected Map<K,V> getProxiedIfModifiable()
UnsupportedOperationException
- if this object is unmodifiableprotected Map<K,V> getProxiedForRead()
public int hashCode()
public abstract boolean isModifiable()
true
if this instance is modifiable, else false
Copyright © 2025. All rights reserved.