List of usage examples for java.util Map isEmpty
boolean isEmpty();
From source file:Main.java
public static String build(Map<String, String> conditions) { if (conditions.isEmpty()) { return null; }// w w w.j a v a2s. co m StringBuilder conditionBuilder = new StringBuilder(); int count = 0; for (Map.Entry<String, String> condition : conditions.entrySet()) { conditionBuilder.append(condition.getKey()); conditionBuilder.append("="); conditionBuilder.append(condition.getValue()); if (count < conditions.entrySet().size() - 1) { conditionBuilder.append("&"); } count++; } return conditionBuilder.toString(); }
From source file:Main.java
public static String generateQueryJson(Map<String, String> params) { if (params == null || params.isEmpty()) return ""; JSONObject aJsonObject = new JSONObject(params); return aJsonObject.toString(); }
From source file:Main.java
/** * return map is empty/*from w w w . ja v a2s . com*/ * @param map * @return */ public static <K, V> boolean isEmpty(Map<K, V> map) { return (null == map || 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 <K, V> boolean isNullOrEmpty(Map<K, V> map) { if ((map == null) || map.isEmpty()) { return true; }/* w ww . j av a 2s. com*/ return false; }
From source file:Main.java
public static boolean isNullOrEmpty(Map<?, ?> map) { return (map == null || map.isEmpty()); }
From source file:Main.java
/** * Checks if map is null or empty// w w w. j av a 2 s.c om * * @param source map to check * @return true if map is null or empty */ private static boolean isEmpty(Map source) { return source == null || source.isEmpty(); }
From source file:Main.java
public static <V> Map<String, V> cleanupMap(Map<String, V> map) { if (map == null || map.isEmpty()) { return null; }/*from ww w . j a va2s . c o m*/ Map<String, V> result = new HashMap<String, V>(map.size()); Set<Entry<String, V>> entries = map.entrySet(); for (Entry<String, V> entry : entries) { if (entry.getValue() != null) { result.put(entry.getKey(), entry.getValue()); } } return result; }
From source file:Main.java
/** * @param c/* www . j a v a2 s. c om*/ * @return */ public static boolean isEmpty(final Map<?, ?> c) { return c == null || c.isEmpty(); }
From source file:Main.java
public static boolean isEmpty(Map<Object, Object> map) { return (map == null || map.isEmpty()); }