Package de.umass.util

Class MapUtilities


  • public final class MapUtilities
    extends java.lang.Object
    Utility class to perform various operations on Maps.
    Author:
    Adrian Woodhead
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void nullSafePut​(java.util.Map<java.lang.String,​java.lang.String> map, java.lang.String key, int value)
      Puts the passed key and value into the map only if the value is not -1.
      static void nullSafePut​(java.util.Map<java.lang.String,​java.lang.String> map, java.lang.String key, java.lang.Integer value)
      Puts the passed key and value into the map only if the value is not null.
      static void nullSafePut​(java.util.Map<java.lang.String,​java.lang.String> map, java.lang.String key, java.lang.String value)
      Puts the passed key and value into the map only if the value is not null.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • nullSafePut

        public static void nullSafePut​(java.util.Map<java.lang.String,​java.lang.String> map,
                                       java.lang.String key,
                                       java.lang.String value)
        Puts the passed key and value into the map only if the value is not null.
        Parameters:
        map - Map to add key and value to.
        key - Map key.
        value - Map value, if null will not be added to map.
      • nullSafePut

        public static void nullSafePut​(java.util.Map<java.lang.String,​java.lang.String> map,
                                       java.lang.String key,
                                       java.lang.Integer value)
        Puts the passed key and value into the map only if the value is not null.
        Parameters:
        map - Map to add key and value to.
        key - Map key.
        value - Map value, if null will not be added to map.
      • nullSafePut

        public static void nullSafePut​(java.util.Map<java.lang.String,​java.lang.String> map,
                                       java.lang.String key,
                                       int value)
        Puts the passed key and value into the map only if the value is not -1.
        Parameters:
        map - Map to add key and value to.
        key - Map key.
        value - Map value, if -1 will not be added to map.