Class RMMapUtils

java.lang.Object
com.reportmill.base.RMMapUtils

public class RMMapUtils extends Object
Utility methods for use with Java.util.Map.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Object
    Returns any element from a map.
    static boolean
    boolValue(Map aMap, String aKey)
    Returns a key value interpreted as a boolean.
    static boolean
    boolValue(Map aMap, String aKey, boolean defaultValue)
    Returns a key value interpreted as a boolean (with optional default value).
    static Map
    clone(Map aMap)
    Clones a map.
    static float
    floatValue(Map aMap, String aKey)
    Returns a key value interpreted as a float.
    static float
    floatValue(Map aMap, String aKey, float defaultValue)
    Returns a key value interpreted as a float (with optional default value).
    static Object
    get(Map aMap, Object aKey)
    Returns value for aKey in given map (accepts null map).
    static Object
    get(Map aMap, Object aKey, Object defaultValue)
    Returns value for aKey in given map with an optional default value for missing keys.
    static Object
    getKey(Map aMap, Object aValue)
    Returns the key for a given object in the given map.
    static Object
    getKeyIdentical(Map aMap, Object aValue)
    Returns the key for a given identical object in the given map.
    static int
    intValue(Map aMap, String aKey)
    Returns a key value interpreted as an int.
    static int
    intValue(Map aMap, String aKey, int defaultValue)
    Returns a key value interpreted as an int (with optional default value).
    static Map
    newMap(Object aKey, Object anObj)
    Creates a new map for given key and object.
    static void
    put(Map aMap, String aKey, Object aValue)
    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 void
    rename(Map aMap, Object aKey, Object newKey)
    Renames a key in a map to a new key.
    static int
    size(Map aMap)
    Returns the size of given map (accepts null map).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RMMapUtils

      public RMMapUtils()
  • Method Details

    • newMap

      public static Map newMap(Object aKey, Object anObj)
      Creates a new map for given key and object.
    • size

      public static int size(Map aMap)
      Returns the size of given map (accepts null map).
    • get

      public static Object get(Map aMap, Object aKey)
      Returns value for aKey in given map (accepts null map).
    • get

      public static Object get(Map aMap, Object aKey, Object defaultValue)
      Returns value for aKey in given map with an optional default value for missing keys.
    • put

      public static void put(Map aMap, String aKey, Object aValue)
      Adds given key and value to given map (removes key if value is null).
    • rename

      public static void rename(Map aMap, Object aKey, Object newKey)
      Renames a key in a map to a new key.
    • clone

      public static Map clone(Map aMap)
      Clones a map.
    • boolValue

      public static boolean boolValue(Map aMap, String aKey)
      Returns a key value interpreted as a boolean.
    • boolValue

      public static boolean boolValue(Map aMap, String aKey, boolean defaultValue)
      Returns a key value interpreted as a boolean (with optional default value).
    • intValue

      public static int intValue(Map aMap, String aKey)
      Returns a key value interpreted as an int.
    • intValue

      public static int intValue(Map aMap, String aKey, int defaultValue)
      Returns a key value interpreted as an int (with optional default value).
    • floatValue

      public static float floatValue(Map aMap, String aKey)
      Returns a key value interpreted as a float.
    • floatValue

      public static float floatValue(Map aMap, String aKey, float defaultValue)
      Returns a key value interpreted as a float (with optional default value).
    • putAllIfAbsent

      public 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).
    • getKey

      public static Object getKey(Map aMap, Object aValue)
      Returns the key for a given object in the given map.
    • getKeyIdentical

      public static Object getKeyIdentical(Map aMap, Object aValue)
      Returns the key for a given identical object in the given map.
    • anyElement

      public static Object anyElement(Map aMap)
      Returns any element from a map.