com.alee.utils
Class MapUtils

java.lang.Object
  extended by com.alee.utils.MapUtils

public final class MapUtils
extends java.lang.Object

This class provides a set of utilities to work with various maps.

Author:
Mikle Garin

Constructor Summary
MapUtils()
           
 
Method Summary
static
<K,V extends java.lang.Cloneable>
java.util.HashMap<K,V>
cloneHashMap(java.util.HashMap<K,V> map)
          Returns HashMap with cloned values.
static
<K,V extends java.lang.Cloneable>
DoubleMap<K,V>
cloneLinkedHashMap(DoubleMap<K,V> map)
          Returns DoubleMap with cloned values.
static
<K,V extends java.lang.Cloneable>
java.util.LinkedHashMap<K,V>
cloneLinkedHashMap(java.util.LinkedHashMap<K,V> map)
          Returns LinkedHashMap with cloned values.
static
<K,V extends java.lang.Cloneable>
java.util.Map<K,V>
cloneMap(java.util.Map<K,V> map)
          Returns Map with cloned values.
static
<K,V> DoubleMap<K,V>
copyDoubleMap(DoubleMap<K,V> map)
          Returns copied DoubleMap.
static
<K,V> java.util.HashMap<K,V>
copyHashMap(java.util.HashMap<K,V> map)
          Returns copied HashMap.
static
<K,V> java.util.LinkedHashMap<K,V>
copyLinkedHashMap(java.util.LinkedHashMap<K,V> map)
          Returns copied LinkedHashMap.
static
<K,V> java.util.Map<K,V>
copyMap(java.util.Map<K,V> map)
          Returns copied Map.
static
<K,V> java.util.HashMap<K,V>
newHashMap(K key, V value)
          Returns newly created HashMap with the specified key and value pair added.
static
<K,V> java.util.HashMap<K,V>
newLinkedHashMap(K key, V value)
          Returns newly created LinkedHashMap with the specified key and value pair added.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapUtils

public MapUtils()
Method Detail

copyMap

public static <K,V> java.util.Map<K,V> copyMap(java.util.Map<K,V> map)
Returns copied Map.

Type Parameters:
K - Map key type
V - Map value type
Parameters:
map - Map to copy
Returns:
copied Map

copyHashMap

public static <K,V> java.util.HashMap<K,V> copyHashMap(java.util.HashMap<K,V> map)
Returns copied HashMap.

Type Parameters:
K - HashMap key type
V - HashMap value type
Parameters:
map - HashMap to copy
Returns:
copied HashMap

copyLinkedHashMap

public static <K,V> java.util.LinkedHashMap<K,V> copyLinkedHashMap(java.util.LinkedHashMap<K,V> map)
Returns copied LinkedHashMap.

Type Parameters:
K - LinkedHashMap key type
V - LinkedHashMap value type
Parameters:
map - LinkedHashMap to copy
Returns:
copied LinkedHashMap

copyDoubleMap

public static <K,V> DoubleMap<K,V> copyDoubleMap(DoubleMap<K,V> map)
Returns copied DoubleMap.

Type Parameters:
K - DoubleMap key type
V - DoubleMap value type
Parameters:
map - DoubleMap to copy
Returns:
copied DoubleMap

cloneMap

public static <K,V extends java.lang.Cloneable> java.util.Map<K,V> cloneMap(java.util.Map<K,V> map)
Returns Map with cloned values.

Type Parameters:
K - Map key type
V - Map value type
Parameters:
map - Map to clone
Returns:
cloned Map

cloneHashMap

public static <K,V extends java.lang.Cloneable> java.util.HashMap<K,V> cloneHashMap(java.util.HashMap<K,V> map)
Returns HashMap with cloned values.

Type Parameters:
K - HashMap key type
V - HashMap value type
Parameters:
map - HashMap to clone
Returns:
cloned HashMap

cloneLinkedHashMap

public static <K,V extends java.lang.Cloneable> java.util.LinkedHashMap<K,V> cloneLinkedHashMap(java.util.LinkedHashMap<K,V> map)
Returns LinkedHashMap with cloned values.

Type Parameters:
K - LinkedHashMap key type
V - LinkedHashMap value type
Parameters:
map - LinkedHashMap to clone
Returns:
cloned LinkedHashMap

cloneLinkedHashMap

public static <K,V extends java.lang.Cloneable> DoubleMap<K,V> cloneLinkedHashMap(DoubleMap<K,V> map)
Returns DoubleMap with cloned values.

Type Parameters:
K - DoubleMap key type
V - DoubleMap value type
Parameters:
map - DoubleMap to clone
Returns:
cloned DoubleMap

newHashMap

public static <K,V> java.util.HashMap<K,V> newHashMap(K key,
                                                      V value)
Returns newly created HashMap with the specified key and value pair added.

Type Parameters:
K - key type
V - value type
Parameters:
key - key to add
value - value to add
Returns:
newly created HashMap

newLinkedHashMap

public static <K,V> java.util.HashMap<K,V> newLinkedHashMap(K key,
                                                            V value)
Returns newly created LinkedHashMap with the specified key and value pair added.

Type Parameters:
K - key type
V - value type
Parameters:
key - key to add
value - value to add
Returns:
newly created LinkedHashMap