Package org.jboss.weld.util.collections
Class ImmutableMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.jboss.weld.util.collections.AbstractImmutableMap<K,V>
org.jboss.weld.util.collections.ImmutableMap<K,V>
- All Implemented Interfaces:
Map<K,V>
Weld's immutable map implementation.
- Author:
- Jozef Hartinger
-
Nested Class Summary
Nested ClassesNested 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
Modifier and TypeMethodDescriptionstatic <K,V> ImmutableMap.Builder<K, V> builder()Creates a new empty builder for building immutable map.static <T,K, V> org.jboss.weld.util.collections.ImmutableMap.ImmutableMapCollector<T, K, V> Returns a collector that accumulates elements into an immutable map.static <K,V> Map<K, V> Creates an immutable map.static <K,V> Map<K, V> of(K key, V value) Creates an immutable singleton instance.Methods inherited from class org.jboss.weld.util.collections.AbstractImmutableMap
clear, isEmpty, put, putAll, removeMethods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, entrySet, equals, get, hashCode, keySet, size, 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
-
copyOf
Creates an immutable map. A copy of the given map is used. As a result, it is safe to modify the source map afterwards.- Parameters:
map- the given map- Returns:
- an immutable map
-
of
Creates an immutable singleton instance.- Parameters:
key-value-- Returns:
-
collector
public static <T,K, org.jboss.weld.util.collections.ImmutableMap.ImmutableMapCollector<T,V> K, collectorV> (Function<T, K> keyMapper, Function<T, V> valueMapper) Returns a collector that accumulates elements into an immutable map.Duplicate mappings are not merged - the old value is replaced.
- Parameters:
keyMapper-valueMapper-- Returns:
- collector
-
builder
Creates a new empty builder for building immutable map.- Returns:
- a new empty builder
-