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

/**
 * Return <code>true</code> if the supplied Map is <code>null</code>
 * or empty. Otherwise, return <code>false</code>.
 *
 * @param map the Map to check/*from ww  w. j  a  v a2s  .  com*/
 * @return whether the given Map is empty
 */
public static boolean isEmpty(Map map) {
    return (map == null || map.isEmpty());
}

From source file:Main.java

/**
 * Check if map is not <tt>null</tt> and empty
 *
 * @param map/*from   ww w  .  j  av a  2  s.  c  o m*/
 *            map to check
 *
 * @return <tt>true</tt>, if map is not null and empty, else <tt>false</tt>
 */
public static <K, V> boolean isEmpty(Map<K, V> map) {
    return map != null && map.isEmpty();
}

From source file:Main.java

/**
 * This is a convenience method that returns true if the specified map is null or empty
 * /* ww  w  . j a v  a2  s .  co  m*/
 * @param <T>
 *            any type of key
 * @param <U>
 *            any type of value
 * @param map
 * @return
 */
public static <T, U> boolean isEmpty(Map<T, U> map) {
    return map == null || map.isEmpty();
}

From source file:Main.java

/**
 * Return true if this map is null or it's empty.
 * //  w  w  w. jav a 2  s  . co  m
 * @param map
 * @return
 */
public static boolean isEmpty(Map<? extends Object, ? extends Object> map) {
    return map == null || map.isEmpty();
}

From source file:org.focusns.common.web.page.config.PageConfigKey.java

public static String generateKey(String path, Map<String, ?> paramsMap) {
    if (paramsMap.isEmpty()) {
        return path;
    }/*  w  w  w  . j a  v a  2s.  c om*/
    //
    StringBuilder sb = new StringBuilder(path);
    for (String paramName : paramsMap.keySet()) {
        if (PARAM_NAMES_EXCLUDE.contains(paramName)) {
            continue;
        }
        //
        String paramValue = String.valueOf(paramsMap.get(paramName));
        if (StringUtils.hasText(paramValue)) {
            sb.append(paramName).append("=").append(paramsMap.get(paramName));
        }
    }
    //
    return sb.toString();
}

From source file:Main.java

public static boolean isEmpty(Map<?, ?>... maps) {
    boolean result = false;

    for (Map<?, ?> map : maps) {
        if (null == map || map.isEmpty()) {
            result = true;//from ww w  .  j a  v  a 2  s. c o  m
            break;
        }
    }

    return result;
}

From source file:Main.java

public static boolean isEmpty(@Nullable final Map<?, ?> aCont) {
    return aCont == null || aCont.isEmpty();
}

From source file:Main.java

public static boolean isNotEmpty(@Nullable final Map<?, ?> aCont) {
    return aCont != null && !aCont.isEmpty();
}

From source file:backtype.storm.messaging.netty.SaslUtils.java

static String getSecretKey(Map conf) {
    if (conf == null || conf.isEmpty())
        return null;

    String secretPayLoad = (String) conf.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD);

    return secretPayLoad;
}

From source file:Main.java

/**
 * Checks if is null or empty./*from  ww  w . j a v  a  2  s.  co  m*/
 *
 * @param map
 *            the map
 * @return true, if is empty
 */
public static boolean isEmpty(Map<?, ?> map) {
    return map == null || map.isEmpty();
}