Class MapTool

java.lang.Object
com.xxl.tool.core.MapTool

public class MapTool extends Object
Map Tool
Author:
xuxueli 2024-01-01
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <K> Boolean
    getBoolean(Map<? super K,?> map, K key)
    get Boolean value
    static <K> Byte
    getByte(Map<? super K,?> map, K key)
    get Byte value
    static <K> Double
    getDouble(Map<? super K,?> map, K key)
    get Double value
    static <K> Float
    getFloat(Map<? super K,?> map, K key)
    get Float value
    static <K> Integer
    getInteger(Map<? super K,?> map, K key)
    get Integer value
    static <K> Long
    getLong(Map<? super K,?> map, K key)
    get Long value
    static <K> Number
    getNumber(Map<? super K,?> map, K key)
    get Number value
    static <K> Short
    getShort(Map<? super K,?> map, K key)
    get Short value
    static <K> String
    getString(Map<? super K,?> map, K key)
    get string value
    static boolean
    isEmpty(Map<?,?> map)
    check if is empty.
    static boolean
    isNotEmpty(Map<?,?> map)
    check if is not empty.
    static <K, V> HashMap<K,V>
    build new HashMap
    static <K, V> HashMap<K,V>
    newMap(K k1, V v1)
    build new HashMap (multi)
    static <K, V> HashMap<K,V>
    newMap(K k1, V v1, K k2, V v2)
    build new HashMap (multi)
    static <K, V> HashMap<K,V>
    newMap(K k1, V v1, K k2, V v2, K k3, V v3)
    build new HashMap (multi)
    static <K, V> HashMap<K,V>
    newMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
    build new HashMap (multi)
    static <K, V> HashMap<K,V>
    newMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)
    build new HashMap (multi)

    Methods inherited from class java.lang.Object

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

    • MapTool

      public MapTool()
  • Method Details

    • isEmpty

      public static boolean isEmpty(Map<?,?> map)
      check if is empty.
      Parameters:
      map - the map to check
      Returns:
    • isNotEmpty

      public static boolean isNotEmpty(Map<?,?> map)
      check if is not empty.
      Parameters:
      map - the map to check
      Returns:
    • getString

      public static <K> String getString(Map<? super K,?> map, K key)
      get string value
      Type Parameters:
      K -
      Parameters:
      map -
      key -
      Returns:
    • getBoolean

      public static <K> Boolean getBoolean(Map<? super K,?> map, K key)
      get Boolean value
      Type Parameters:
      K -
      Parameters:
      map -
      key -
      Returns:
    • getNumber

      public static <K> Number getNumber(Map<? super K,?> map, K key)
      get Number value
      Type Parameters:
      K -
      Parameters:
      map -
      key -
      Returns:
    • getByte

      public static <K> Byte getByte(Map<? super K,?> map, K key)
      get Byte value
      Type Parameters:
      K -
      Parameters:
      map -
      key -
      Returns:
    • getShort

      public static <K> Short getShort(Map<? super K,?> map, K key)
      get Short value
      Type Parameters:
      K -
      Parameters:
      map -
      key -
      Returns:
    • getInteger

      public static <K> Integer getInteger(Map<? super K,?> map, K key)
      get Integer value
      Type Parameters:
      K -
      Parameters:
      map -
      key -
      Returns:
    • getLong

      public static <K> Long getLong(Map<? super K,?> map, K key)
      get Long value
      Type Parameters:
      K -
      Parameters:
      map -
      key -
      Returns:
    • getFloat

      public static <K> Float getFloat(Map<? super K,?> map, K key)
      get Float value
      Type Parameters:
      K -
      Parameters:
      map -
      key -
      Returns:
    • getDouble

      public static <K> Double getDouble(Map<? super K,?> map, K key)
      get Double value
      Type Parameters:
      K -
      Parameters:
      map -
      key -
      Returns:
    • newMap

      public static <K, V> HashMap<K,V> newMap()
      build new HashMap
      Type Parameters:
      K -
      V -
      Returns:
    • newMap

      public static <K, V> HashMap<K,V> newMap(K k1, V v1)
      build new HashMap (multi)
      Type Parameters:
      K -
      V -
      Parameters:
      k1 -
      v1 -
      Returns:
    • newMap

      public static <K, V> HashMap<K,V> newMap(K k1, V v1, K k2, V v2)
      build new HashMap (multi)
    • newMap

      public static <K, V> HashMap<K,V> newMap(K k1, V v1, K k2, V v2, K k3, V v3)
      build new HashMap (multi)
    • newMap

      public static <K, V> HashMap<K,V> newMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
      build new HashMap (multi)
    • newMap

      public static <K, V> HashMap<K,V> newMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)
      build new HashMap (multi)