@NotThreadSafe public class CompositeMap<K,V> extends AbstractMap<K,V> implements Map<K,V>
Changes made to this map will only be made on the first map.
Note that CompositeMap is not synchronized and is not thread-safe.
If you wish to use this map from multiple threads concurrently, you must use
appropriate synchronization. The simplest approach is to wrap this map
using Collections.synchronizedMap(Map)
. This class will behave
in an unspecified manner if accessed by concurrent threads without synchronization.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(Object key) |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
boolean |
isEmpty() |
Set<K> |
keySet() |
static <K,V> Map<K,V> |
of(Map<K,V> one,
Map<K,V> two)
Create a new CompositeMap with two composited Map instances.
|
V |
put(K key,
V value) |
V |
remove(Object key) |
clear, clone, containsValue, equals, hashCode, putAll, size, toString, values
finalize, getClass, notify, notifyAll, wait, wait, wait
clear, compute, computeIfAbsent, computeIfPresent, containsValue, equals, forEach, getOrDefault, hashCode, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, values
public static <K,V> Map<K,V> of(Map<K,V> one, Map<K,V> two)
one
- the first Map to be composited, values here override values in the second.two
- the second Map to be compositedIllegalArgumentException
- if there is a key collisionpublic boolean containsKey(Object key)
containsKey
in interface Map<K,V>
containsKey
in class AbstractMap<K,V>
public boolean isEmpty()
Copyright © 2003–2016 Atlassian. All rights reserved.