List of usage examples for java.util Map isEmpty
boolean isEmpty();
From source file:Main.java
/** * Return <code>true</code> if the supplied Map is <code>null</code> or empty. Otherwise, return <code>false</code>. * /*w w w.ja v a 2 s.c o m*/ * @param map * the Map to check * @return whether the given Map is empty */ public static boolean isEmpty(Map<?, ?> map) { return ((map == null) || map.isEmpty()); }
From source file:Main.java
public static boolean isEmpty(final Map<?, ?> map) { return map == null || map.isEmpty(); }
From source file:Main.java
public static boolean isEmpty(Map<? extends Object, ? extends Object> map) { return (map == null) || (map.isEmpty()); }
From source file:Main.java
/** * Tests whether map contains no elements, true if map is null or map is empty. * @param map Map to test.//from w w w. ja v a 2s . c o m * @return Whether map contains no elements. */ public static boolean isNullOrEmpty(@Nullable final Map map) { return map == null || map.isEmpty(); }
From source file:Main.java
/** Checks if a map is null or empty. */ public static boolean isNullOrEmpty(@Nullable Map<?, ?> potentiallyNull) { return potentiallyNull == null || potentiallyNull.isEmpty(); }
From source file:Main.java
public static boolean isNotEmpty(Map<? extends Object, ? extends Object> map) { return (map != null) && (!map.isEmpty()); }
From source file:Main.java
/** * Return <code>true</code> if the supplied Map is <code>null</code> or * empty. Otherwise, return <code>false</code>. * /*from www . j a v a 2s .c om*/ * @param map * the Map to check * @return whether the given Map is empty */ public static boolean isEmpty(final Map<?, ?> map) { return ((map == null) || map.isEmpty()); }
From source file:Main.java
/** * makes sense only if iteration order deterministic! */// w w w. ja v a 2 s. co m private static <K, V> Map.Entry<K, V> getRandomElement(final boolean remove, final Random random, final Map<K, V> map) { if (map.isEmpty()) throw new IllegalArgumentException("map is empty!"); final int index = random.nextInt(map.size()); final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator(); int i = 0; while (i++ < index) it.next(); final Map.Entry<K, V> elem = it.next(); if (remove) it.remove(); return elem; }
From source file:Main.java
public static boolean isNotEmpty(final Map<?, ?> m) { return m != null && m.isEmpty() == false; }
From source file:Main.java
public static boolean isNull(Map<?, ?> map) { if (map == null || map.isEmpty()) { return true; }/*w w w .j av a2 s . com*/ return false; }