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 mapNotEmpty(Map<?, ?> map) {
    return !(null == map || map.size() == 0);
}

From source file:Main.java

public static <T> T getMapOnlyValue(Map<? extends Object, T> map) {
    if (map.size() != 1) {
        throw new IllegalArgumentException("Can't get map only value, it has " + map.size() + " elements");
    }//from   w  ww  .ja  v  a2 s.c om
    return map.values().iterator().next();
}

From source file:Main.java

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

    return false;
}

From source file:Main.java

public static boolean mapNotEmpty(Map<?, ?> map) {
    if (null == map || map.size() == 0) {
        return false;
    }/*from ww  w .  ja v  a  2  s .c o  m*/
    return true;
}

From source file:Main.java

public static boolean mapEmpty(Map<?, ?> map) {
    if (null == map || map.size() == 0) {
        return true;
    }/* ww w  . j  a  v  a 2 s .co m*/
    return false;
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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