public class MyMap
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <K,V> java.util.Map<K,V> |
intersect(java.util.Map<K,V> map1,
K[] keysToBeIncluded)
Returns a Map that holds only the entries from map1 whose keys also occur in keys-to-be-included.
|
static <K,V> java.util.Map<K,V> |
intersect(java.util.Map<K,V> map1,
K[] keysToBeIncluded,
java.lang.Class<? extends java.util.Map<K,V>> resultClass)
Returns a Map that holds only the entries of map1 whose keys also occur in keys-to-be-included
|
static <K,V> java.util.Map<K,V> |
intersect(java.util.Map<K,V> map1,
java.util.Set<K> keysToBeIncluded)
Returns a Map that holds only the entries from map1 whose keys also occur in keys-to-be-included.
|
static <K,V> java.util.Map<K,V> |
intersect(java.util.Map<K,V> map1,
java.util.Set<K> keysToBeIncluded,
java.lang.Class<? extends java.util.Map<K,V>> resultClass)
Returns a Map that holds only the entries of map1 whose keys also occur in keys-to-be-included
|
static <K,V> void |
intersectIntoMap(java.util.Map<K,V> map1,
K[] keysToBeIncluded,
java.util.Map<? super K,? super V> result)
Puts all entries that appear either in map1 in the result map, iff its key appears in the given set of keys-to-be-included.
|
static <K,V> void |
intersectIntoMap(java.util.Map<K,V> map1,
java.util.Set<K> keysToBeIncluded,
java.util.Map<? super K,? super V> result)
Puts all entries that appear either in map1 in the result map, iff its key appears in the given set of keys-to-be-included.
|
static <K,V> java.util.Map<K,V> |
minus(java.util.Map<K,V> map1,
java.util.Collection<K> keysToBeExcluded)
Returns a Map that holds only the entries whose keys do not occur in the given set of keys-to-be-excluded
|
static <K,V> java.util.Map<K,V> |
minus(java.util.Map<K,V> map1,
java.util.Collection<K> keysToBeExcluded,
java.lang.Class<? extends java.util.Map<K,V>> resultClass)
Returns a Map that holds only the entries whose keys do not occur in the given set of keys-to-be-excluded
|
static <K,V> void |
minusIntoMap(java.util.Map<K,V> map1,
java.util.Collection<K> keysToBeExcluded,
java.util.Map<? super K,? super V> result)
Puts all entries that appear either in map1 in the result map, iff its key does not appear in the given set of keys-to-be-excluded.
|
static <K,V> java.util.Map<K,V> |
union(java.util.Map<K,V> map1,
java.util.Map<K,V> map2)
Returns a Map that holds all the entries that appear either in map1 or map2
|
static <K,V> java.util.Map<K,V> |
union(java.util.Map<K,V> map1,
java.util.Map<K,V> map2,
java.lang.Class<? extends java.util.Map<K,V>> resultClass)
Returns a Map that holds all the entries that appear either in map1 or map2
|
static <K,V> void |
unionIntoMap(java.util.Map<K,V> map1,
java.util.Map<K,V> map2,
java.util.Map<? super K,? super V> result)
Puts all entries that appear either in map1 or map2 in the result map.
|
public static <K,V> java.util.Map<K,V> intersect(java.util.Map<K,V> map1, K[] keysToBeIncluded)
K
- the key typeV
- the value typemap1
- A map whose entries are to be copied into the result, iff the entry's key value appears in keysToBeExcludedkeysToBeIncluded
- The set of keys that are to appear in the resulting mappublic static <K,V> java.util.Map<K,V> intersect(java.util.Map<K,V> map1, K[] keysToBeIncluded, java.lang.Class<? extends java.util.Map<K,V>> resultClass) throws java.lang.InstantiationException, java.lang.IllegalAccessException
K
- the key typeV
- the value typemap1
- The map to be copied from / 'intersected' with the given set of keys-to-be-includedkeysToBeIncluded
- the keys that are to appear in the resulting mapresultClass
- the Class that the result object must be. This class must implement the Map interface and have a public no-arg constructor.java.lang.IllegalAccessException
- if the class or its nullary constructor is not accessible.java.lang.InstantiationException
- if this Class
represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.public static <K,V> java.util.Map<K,V> intersect(java.util.Map<K,V> map1, java.util.Set<K> keysToBeIncluded)
K
- the key typeV
- the value typemap1
- A map whose entries are to be copied into the result, iff the entry's key value appears in keysToBeExcludedkeysToBeIncluded
- The set of keys that are to appear in the resulting mappublic static <K,V> java.util.Map<K,V> intersect(java.util.Map<K,V> map1, java.util.Set<K> keysToBeIncluded, java.lang.Class<? extends java.util.Map<K,V>> resultClass) throws java.lang.InstantiationException, java.lang.IllegalAccessException
K
- the key typeV
- the value typemap1
- The map to be copied from / 'intersected' with the given set of keys-to-be-includedkeysToBeIncluded
- the keys that are to appear in the resulting mapresultClass
- the Class that the result object must be. This class must implement the Map interface and have a public no-arg constructor.java.lang.IllegalAccessException
- if the class or its nullary constructor is not accessible.java.lang.InstantiationException
- if this Class
represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.public static <K,V> void intersectIntoMap(java.util.Map<K,V> map1, K[] keysToBeIncluded, java.util.Map<? super K,? super V> result)
K
- the key typeV
- the value typemap1
- A map whose entries are to be copied into the result, iff the entry's key value appears in keysToBeExcludedkeysToBeIncluded
- The set of keys that are to appear in the resulting mapresult
- A map to put the result in. The map is cleared first.public static <K,V> void intersectIntoMap(java.util.Map<K,V> map1, java.util.Set<K> keysToBeIncluded, java.util.Map<? super K,? super V> result)
K
- the key typeV
- the value typemap1
- A map whose entries are to be copied into the result, iff the entry's key value appears in keysToBeExcludedkeysToBeIncluded
- The set of keys that are to appear in the resulting mapresult
- A map to put the result in. The map is cleared first.public static <K,V> java.util.Map<K,V> minus(java.util.Map<K,V> map1, java.util.Collection<K> keysToBeExcluded)
K
- the key typeV
- the value typemap1
- A map whose entries are to be copied into the result, but for the entries whose key value appears in keysToBeExcludedkeysToBeExcluded
- The set of keys that are not to appear in the resulting mappublic static <K,V> java.util.Map<K,V> minus(java.util.Map<K,V> map1, java.util.Collection<K> keysToBeExcluded, java.lang.Class<? extends java.util.Map<K,V>> resultClass) throws java.lang.InstantiationException, java.lang.IllegalAccessException
K
- the key typeV
- the value typemap1
- A map whose entries are to be copied into the result, but for the entries whose key value appears in keysToBeExcludedkeysToBeExcluded
- The set of keys that are not to appear in the resulting mapresultClass
- the Class that the result object must bejava.lang.IllegalAccessException
- if the class or its nullary constructor is not accessible.java.lang.InstantiationException
- if this Class
represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.public static <K,V> void minusIntoMap(java.util.Map<K,V> map1, java.util.Collection<K> keysToBeExcluded, java.util.Map<? super K,? super V> result)
K
- the key typeV
- the value typemap1
- A map whose entries are to be copied into the result, but for the entries whose key value appears in keysToBeExcludedkeysToBeExcluded
- The set of keys that are not to appear in the resulting mapresult
- A map to put the result in. The map is cleared first.public static <K,V> java.util.Map<K,V> union(java.util.Map<K,V> map1, java.util.Map<K,V> map2) throws EqualKeyUnequalValuesException
K
- the key typeV
- the value typemap1
- A map to be 'unioned' with map2map2
- A map to be 'unioned' with map1EqualKeyUnequalValuesException
- If some key value appears in both map1 and map2, and that key maps to two unequal values that are both non-null.public static <K,V> java.util.Map<K,V> union(java.util.Map<K,V> map1, java.util.Map<K,V> map2, java.lang.Class<? extends java.util.Map<K,V>> resultClass) throws EqualKeyUnequalValuesException, java.lang.InstantiationException, java.lang.IllegalAccessException
K
- the key typeV
- the value typemap1
- the map to be unioned with map2map2
- the map to be unioned with map1resultClass
- the Class that the result object must be. This class must implement the Map interface, and have a public no-arg constructor.EqualKeyUnequalValuesException
- If some key value appears in both map1 and map2, and that key maps to two unequal values that are both non-null.java.lang.IllegalAccessException
- if the class or its nullary constructor is not accessible.java.lang.InstantiationException
- if this Class
represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.public static <K,V> void unionIntoMap(java.util.Map<K,V> map1, java.util.Map<K,V> map2, java.util.Map<? super K,? super V> result) throws EqualKeyUnequalValuesException
K
- the key typeV
- the value typemap1
- A map to be 'unioned' with map2map2
- A map to be 'unioned' with map1result
- A map wherein all entries of map1 and map2 are placed. The map is cleared first.EqualKeyUnequalValuesException
- If some key value appears in both map1 and map2, and that key maps to two unequal values that are both non-null.