Class MapUtils

  • All Implemented Interfaces:

    
    public final class MapUtils
    
                        

    Utility class for Maps

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static boolean isNullOrEmpty(@Nullable() Map<out Object, out Object> map) Checks if the provided map is null or it has no element
      static void putIfNotEmpty(@Nullable() Map<String, Object> map, @Nullable() String key, @Nullable() Object value) Adds key/value to map if value is not null or an empty string, map or collection.
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • isNullOrEmpty

         static boolean isNullOrEmpty(@Nullable() Map<out Object, out Object> map)

        Checks if the provided map is null or it has no element

        Parameters:
        map - the map to be verified
        Returns:

        true if null or empty, false otherwise

      • putIfNotEmpty

         static void putIfNotEmpty(@Nullable() Map<String, Object> map, @Nullable() String key, @Nullable() Object value)

        Adds key/value to map if value is not null or an empty string, map or collection.

        Parameters:
        map - collection to put values mapped to key if values is non-null and contains at least one entry
        key - key used to map value in map
        value - an object to add to map if not null or empty