Example usage for java.util Map isEmpty

List of usage examples for java.util Map isEmpty

Introduction

In this page you can find the example usage for java.util Map isEmpty.

Prototype

boolean isEmpty();

Source Link

Document

Returns true if this map contains no key-value mappings.

Usage

From source file:Main.java

public static boolean isEmpty(Map<?, ?> map) {
    if (map == null || map.isEmpty()) {
        return true;
    }/*from  ww  w  .  j av  a2s.  c o m*/
    return false;
}

From source file:Main.java

public static boolean isValid(Map<?, ?> map) {
    return map != null && !map.isEmpty();
}

From source file:Main.java

public static <K, V> boolean isNullOrEmpty(final Map<K, V> m) {
    return m == null || m.isEmpty();
}

From source file:Main.java

public static List<NameValuePair> convertMap2List(Map<String, String> params) {
    if (params.isEmpty())
        return null;
    List<NameValuePair> paramList = new ArrayList<NameValuePair>();
    for (Map.Entry<String, String> entry : params.entrySet()) {
        paramList.add(new BasicNameValuePair(entry.getKey().trim(), entry.getValue().trim()));
    }//from  ww  w.  jav a 2 s  .  c  om
    return paramList;
}

From source file:Main.java

/**
 * Checks if a map is null or empty//from w ww.j  a  va  2 s  . c  o  m
 *
 * @param map - the map
 * @return - if it is empty
 * @since 1.0
 */
public static boolean isEmpty(Map map) {
    return map == null || map.isEmpty();
}

From source file:Main.java

public static Boolean isEmpty(Map<?, ?> map) {
    return (map == null || map.isEmpty());
}

From source file:Main.java

public static boolean isBlank(Map map) {
    return (map == null || map.isEmpty());
}

From source file:Main.java

public static boolean isValidate(Map<?, ?> map) {
    return map != null && !map.isEmpty();
}

From source file:Main.java

public static <K, V> boolean isNullOrEmpty(Map<K, V> map) {
    return map == null || map.isEmpty();
}

From source file:Main.java

public static String simpleMapToJsonStr(Map map) {
    if (map == null || map.isEmpty()) {
        return "null";
    }//from  w  ww .j  a v a 2  s  .  c om
    String jsonStr = "{";
    Set<?> keySet = map.keySet();
    for (Object key : keySet) {
        jsonStr += "\"" + key + "\":\"" + map.get(key) + "\",";
    }
    jsonStr = jsonStr.substring(0, jsonStr.length() - 1);
    jsonStr += "}";
    return jsonStr;
}