Package snap.util
Class MapUtils
java.lang.Object
snap.util.MapUtils
Utility methods for use with Java.util.Map.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
anyElement
(Map aMap) Returns any element from a map.static <K,
V> boolean Returns a key value interpreted as a boolean.static <K,
V> boolean Returns a key value interpreted as a boolean (with optional default value).static Map
Clones a map.static <K,
V> float floatValue
(Map<K, V> aMap, K aKey) Returns a key value interpreted as a float.static <K,
V> float floatValue
(Map<K, V> aMap, K aKey, float defaultValue) Returns a key value interpreted as a float (with optional default value).static <K,
V> V Returns value for aKey in given map (accepts null map).static <K,
V> V Returns value for aKey in given map with an optional default value for missing keys.static Object
Returns the key for a given object in the given map.static Object
Returns the key for a given identical object in the given map.static <K,
V> int Returns a key value interpreted as an int.static <K,
V> int Returns a key value interpreted as an int (with optional default value).static Map
Creates a new map with given args in key/value sequence.static Map
Creates a new map for given key and object.static <K,
V> V Adds given key and value to given map (removes key if value is null).static Map
putAllIfAbsent
(Map m1, Map m2, boolean copyIfAbsent) Same as putAll, but only adds absent keys (option to copy if there are absent keys).static int
Returns the size of given map (accepts null map).static String
toStringSafe
(Map aMap) Returns a string representation of map that doesn't recurse.
-
Constructor Details
-
MapUtils
public MapUtils()
-
-
Method Details
-
newMap
Creates a new map for given key and object. -
newMap
Creates a new map with given args in key/value sequence. -
size
Returns the size of given map (accepts null map). -
get
Returns value for aKey in given map (accepts null map). -
get
Returns value for aKey in given map with an optional default value for missing keys. -
put
Adds given key and value to given map (removes key if value is null). -
clone
Clones a map. -
boolValue
Returns a key value interpreted as a boolean. -
boolValue
Returns a key value interpreted as a boolean (with optional default value). -
intValue
Returns a key value interpreted as an int. -
intValue
Returns a key value interpreted as an int (with optional default value). -
floatValue
Returns a key value interpreted as a float. -
floatValue
Returns a key value interpreted as a float (with optional default value). -
putAllIfAbsent
Same as putAll, but only adds absent keys (option to copy if there are absent keys). -
getKey
Returns the key for a given object in the given map. -
getKeyId
Returns the key for a given identical object in the given map. -
anyElement
Returns any element from a map. -
toStringSafe
Returns a string representation of map that doesn't recurse.
-