Package org.elasticsearch.common.util
Class Maps
java.lang.Object
org.elasticsearch.common.util.Maps
public class Maps
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description Maps()
-
Method Summary
Modifier and Type Method Description static <K, V> java.util.Map<K,V>
copyMapWithRemovedEntry(java.util.Map<K,V> map, K key)
Remove the specified key from the provided immutable map by copying the underlying map and filtering out the specified key if that key exists.static <K, V> boolean
deepEquals(java.util.Map<K,V> left, java.util.Map<K,V> right)
Returnstrue
if the two specified maps are equal to one another.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Maps
public Maps()
-
-
Method Details
-
deepEquals
public static <K, V> boolean deepEquals(java.util.Map<K,V> left, java.util.Map<K,V> right)Returnstrue
if the two specified maps are equal to one another. Two maps are considered equal if both represent identical mappings where values are checked with Objects.deepEquals. The primary use case is to check if two maps with array values are equal.- Parameters:
left
- one map to be tested for equalityright
- the other map to be tested for equality- Returns:
true
if the two maps are equal
-
copyMapWithRemovedEntry
public static <K, V> java.util.Map<K,V> copyMapWithRemovedEntry(java.util.Map<K,V> map, K key)Remove the specified key from the provided immutable map by copying the underlying map and filtering out the specified key if that key exists.- Type Parameters:
K
- the type of the keys in the mapV
- the type of the values in the map- Parameters:
map
- the immutable map to remove the key fromkey
- the key to be removed- Returns:
- an immutable map that contains the items from the specified map with the provided key removed
-