Example usage for java.util Map size

List of usage examples for java.util Map size

Introduction

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

Prototype

int size();

Source Link

Document

Returns the number of key-value mappings in this map.

Usage

From source file:Main.java

public static boolean isNotEmpty(Map map) {
    return map != null && map.size() > 0;
}

From source file:Main.java

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

From source file:Main.java

public static boolean isEmpty(Map<?, ?> map) {
    return map == null || map.size() == 0 ? true : false;
}

From source file:Main.java

/**
 * Returns the size of the specified map or {@code 0} if the map is
 * {@code null}./*from  w ww.j  a  va  2s .  c  o  m*/
 *
 * @param m
 *            the map to check
 * @return the size of the specified map or {@code 0} if the map is
 *         {@code null}.
 * @since 1.2
 */
public static int size(Map m) {
    return m != null ? m.size() : 0;
}

From source file:Main.java

public static boolean isNEmpty(Map<?, ?> map) {
    if ((map != null) && (map.size() > 0)) {
        return true;
    }//from w w  w . j  a v  a2  s.co m
    return false;
}

From source file:Main.java

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

From source file:Main.java

final static public boolean isEmpty(Map<Object, Object> map) {
    return map == null || map.size() == 0;
}

From source file:Main.java

public static int size(Map map) {
    return isEmpty(map) ? 0 : map.size();
}

From source file:Main.java

@SuppressWarnings("rawtypes")
public static boolean isNotEmpty(Map map) {
    return map != null && map.size() > 0;
}

From source file:Main.java

public static <K, V> HashMap<K, V> toHashMap(Map<K, V> map) {
    HashMap<K, V> result = new HashMap<>(map.size());
    result.putAll(map);//from   w  w w  .j a  va2s .c  o  m
    return result;
}