Package com.atlassian.jira.util.collect
Class CompositeMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
com.atlassian.jira.util.collect.CompositeMap<K,V>
- All Implemented Interfaces:
Map<K,V>
Provides a union view of two maps.
Restrictions:
- 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
Collections.synchronizedMap(Map). This class will behave in an undefined manner if accessed by concurrent threads without synchronization.
-
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
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Method Details
-
of
Create a new CompositeMap with two composited Map instances.- Parameters:
one- the first Map to be composited, values here override values in the second.two- the second Map to be composited- Returns:
- the CompositeMap, or one itself if two is empty
- Throws:
IllegalArgumentException- if either map is null
-
keySet
-
entrySet
-
isEmpty
public boolean isEmpty() -
size
public int size() -
containsKey
- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
get
-
put
-
putAll
-
remove
-
clear
public void clear()
-