类 MapUtil


  • public class MapUtil
    extends java.lang.Object
    Map utils.
    作者:
    liaochuntao
    • 构造器概要

      构造器 
      构造器 说明
      MapUtil()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static <K,​C,​V,​T>
      V
      computeIfAbsent​(java.util.Map<K,​V> target, K key, java.util.function.BiFunction<C,​T,​V> mappingFunction, C param1, T param2)
      ComputeIfAbsent lazy load.
      static boolean isEmpty​(java.util.Dictionary coll)
      Null-safe check if the specified Dictionary is empty.
      static boolean isEmpty​(java.util.Map map)
      Null-safe check if the specified Dictionary is empty.
      static boolean isNotEmpty​(java.util.Dictionary coll)
      Null-safe check if the specified Dictionary is not empty.
      static boolean isNotEmpty​(java.util.Map map)
      Null-safe check if the specified Dictionary is not empty.
      static void putIfValNoEmpty​(java.util.Map target, java.lang.Object key, java.lang.Object value)
      Put into map if value is not empty.
      static void putIfValNoNull​(java.util.Map target, java.lang.Object key, java.lang.Object value)
      Put into map if value is not null.
      static <K,​V>
      V
      removeKey​(java.util.Map<K,​V> map, K key, java.util.function.Predicate<V> removeJudge)
      remove value, Thread safety depends on whether the Map is a thread-safe Map.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • MapUtil

        public MapUtil()
    • 方法详细资料

      • isEmpty

        public static boolean isEmpty​(java.util.Map map)
        Null-safe check if the specified Dictionary is empty.

        Null returns true.

        参数:
        map - the collection to check, may be null
        返回:
        true if empty or null
      • isEmpty

        public static boolean isEmpty​(java.util.Dictionary coll)
        Null-safe check if the specified Dictionary is empty.

        Null returns true.

        参数:
        coll - the collection to check, may be null
        返回:
        true if empty or null
      • isNotEmpty

        public static boolean isNotEmpty​(java.util.Map map)
        Null-safe check if the specified Dictionary is not empty.

        Null returns false.

        参数:
        map - the collection to check, may be null
        返回:
        true if non-null and non-empty
      • isNotEmpty

        public static boolean isNotEmpty​(java.util.Dictionary coll)
        Null-safe check if the specified Dictionary is not empty.

        Null returns false.

        参数:
        coll - the collection to check, may be null
        返回:
        true if non-null and non-empty
      • putIfValNoNull

        public static void putIfValNoNull​(java.util.Map target,
                                          java.lang.Object key,
                                          java.lang.Object value)
        Put into map if value is not null.
        参数:
        target - target map
        key - key
        value - value
      • putIfValNoEmpty

        public static void putIfValNoEmpty​(java.util.Map target,
                                           java.lang.Object key,
                                           java.lang.Object value)
        Put into map if value is not empty.
        参数:
        target - target map
        key - key
        value - value
      • computeIfAbsent

        @NotThreadSafe
        public static <K,​C,​V,​T> V computeIfAbsent​(java.util.Map<K,​V> target,
                                                                    K key,
                                                                    java.util.function.BiFunction<C,​T,​V> mappingFunction,
                                                                    C param1,
                                                                    T param2)
        ComputeIfAbsent lazy load.
        参数:
        target - target Map data.
        key - map key.
        mappingFunction - function which is need to be executed.
        param1 - function's parameter value1.
        param2 - function's parameter value1.
        返回:
      • removeKey

        public static <K,​V> V removeKey​(java.util.Map<K,​V> map,
                                              K key,
                                              java.util.function.Predicate<V> removeJudge)
        remove value, Thread safety depends on whether the Map is a thread-safe Map.
        类型参数:
        K - key type
        V - value type
        参数:
        map - map
        key - key
        removeJudge - judge this key can be remove
        返回:
        value