@NotThreadSafe
public class CompositeMap<K,V>
extends java.util.AbstractMap<K,V>
implements java.util.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.
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(java.lang.Object key) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
V |
get(java.lang.Object key) |
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
static <K,V> java.util.Map<K,V> |
of(java.util.Map<K,V> one,
java.util.Map<K,V> two)
Create a new CompositeMap with two composited Map instances.
|
V |
put(K key,
V value) |
V |
remove(java.lang.Object key) |
clear, clone, containsValue, equals, hashCode, putAll, size, toString, values
public static <K,V> java.util.Map<K,V> of(java.util.Map<K,V> one, java.util.Map<K,V> two)
one
- the first Map to be composited, values here override values in the second.two
- the second Map to be compositedjava.lang.IllegalArgumentException
- if there is a key collisionpublic V get(java.lang.Object key)
public java.util.Set<K> keySet()
public boolean containsKey(java.lang.Object key)
public boolean isEmpty()
Copyright © 2003-2014 Atlassian. All Rights Reserved.