@NotThreadSafe public class


extends AbstractMap<K, V>
   ↳ java.util.AbstractMap<K, V>
     ↳ com.atlassian.jira.util.collect.CompositeMap<K, V>

Class Overview

Provides a union view of two maps.


  • The supplied maps become the property of the new map. They should not be accessed directly in any way after the composite map is created. The result of such access is left undefined.
  • The mutability of this map depends on that of the first map. For efficiency reasons, this class uses the first map to hold updated state. If the first map is immutable, then this map will be, too. The second map in never modified by this class.
  • 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 synchronizedMap(Map). This class will behave in an undefined manner if accessed by concurrent threads without synchronization.


Public Methods
void clear()
boolean containsKey(Object key)
Set<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)
void putAll(Map<? extends K, ? extends V> m)
V remove(Object key)
int size()
Inherited Methods
From class java.util.AbstractMap
From class java.lang.Object
From interface java.util.Map

Public Methods

public void clear ()

public boolean containsKey (Object key)

public Set<Entry<K, V>> entrySet ()

public V get (Object key)

public boolean isEmpty ()

public Set<K> keySet ()

public static Map<K, V> of (Map<K, V> one, Map<K, V> two)

Create a new CompositeMap with two composited Map instances.

one the first Map to be composited, values here override values in the second.
two the second Map to be composited
  • the CompositeMap, or one itself if two is empty
IllegalArgumentException if either map is null

public V put (K key, V value)

public void putAll (Map<? extends K, ? extends V> m)

public V remove (Object key)

public int size ()