List of usage examples for java.util Map isEmpty
boolean isEmpty();
From source file:jp.mixi.android.sdk.util.UrlUtils.java
/** * map???/*from ww w . j a va 2s . c o m*/ * * @param params ?Map * @return ???String */ public static String encodeUrl(Map<String, String> params) { if (params == null || params.isEmpty()) { return ""; } StringBuilder builder = new StringBuilder(); boolean first = true; for (String key : params.keySet()) { if (first) { first = false; } else { builder.append(PARAM_SEPARATOR); } String value = params.get(key); if (key != null && value != null) { try { builder.append(URLEncoder.encode(key, HTTP.UTF_8) + EQUAL + URLEncoder.encode(params.get(key), HTTP.UTF_8)); } catch (UnsupportedEncodingException e) { Log.e(TAG, e.getLocalizedMessage(), e); } } } return builder.toString(); }
From source file:$.Collections3.java
/** * ?./*www .j a v a 2s.c o m*/ */ public static boolean isEmpty(Map map) { return (map == null) || map.isEmpty(); }
From source file:com.github.gaoyangthu.core.hbase.HbaseSynchronizationManager.java
/** * Returns the bound tables (by name)./* w w w . j av a2 s . c o m*/ * * @return names of bound tables */ public static Set<String> getTableNames() { Map<String, HTableInterface> map = resources.get(); if (map != null && !map.isEmpty()) { return Collections.unmodifiableSet(map.keySet()); } return Collections.emptySet(); }
From source file:com.intel.podm.common.types.Status.java
/** * Creates Status object instance from map * @param statusMap map representation of Status * @return Status object instance//from www . j ava 2 s . c o m * @throws IllegalArgumentException if Status object instance cannot be created */ public static Status fromMap(Map<String, String> statusMap) { if (statusMap == null || statusMap.isEmpty()) { return null; } State state = ofNullable(statusMap.get(STATE_PROPERTY)).map(Status::mapState).orElse(null); Health health = ofNullable(statusMap.get(HEALTH_PROPERTY)).map(Status::mapHealth).orElse(null); Health healthRollup = ofNullable(statusMap.get(HEALTH_ROLLUP_PROPERTY)).map(Status::mapHealth).orElse(null); return new Status(state, health, healthRollup); }
From source file:com.jms.notify.utils.StringUtil.java
/** * Map??. ?? /*from w w w.ja v a2s . com*/ * * @? @param obj * @? @return * @return boolean * @throws */ public static boolean isEmpty(Map<?, ?> obj) { return null == obj || obj.isEmpty(); }
From source file:de.micromata.genome.logging.LogRequestParameterAttribute.java
/** * Gets the request for logging./* w w w . j a va 2 s .co m*/ * * @param request the request * @param excludingKeys the excluding keys * @return the request for logging */ public static String getRequestForLogging(Map<String, Object> request, String... excludingKeys) { if (request == null || request.isEmpty() == true) { return "<no params>"; } StringBuilder sb = new StringBuilder(); for (Map.Entry<String, Object> me : request.entrySet()) { final String key = me.getKey(); String value = Objects.toString(me.getValue(), StringUtils.EMPTY); for (String exKey : excludingKeys) { if (StringUtils.equals(key, exKey) == true) { value = "****"; break; } } // for sb.append(key).append('=').append(value).append('\n'); } return sb.toString(); }
From source file:net.duckling.common.util.CommonUtils.java
/** * ??/*from w ww .jav a 2s .co m*/ * @param map Map * */ public static boolean isNull(Map<?, ?> map) { return (map == null || (map.isEmpty())); }
From source file:Main.java
/** * Creates a tag from the given string values. Can be used for creating html or xml tags. * /*w ww . ja v a 2 s. c om*/ * @param tagname * the tagname * @param value * the value from the tag. * @param attributtes * a map with the attributtes * @return the string */ public static String newTag(final String tagname, final String value, final Map<String, String> attributtes) { StringBuilder xmlTag = new StringBuilder(); xmlTag.append("<").append(tagname); if (attributtes != null && !attributtes.isEmpty()) { xmlTag.append(" "); int count = 1; for (Map.Entry<String, String> attributte : attributtes.entrySet()) { xmlTag.append(attributte.getKey()); xmlTag.append("="); xmlTag.append("\"").append(attributte.getValue()).append("\""); if (count != attributtes.size()) { xmlTag.append(" "); } count++; } } xmlTag.append(">"); xmlTag.append(value); xmlTag.append("</").append(tagname).append(">"); return xmlTag.toString(); }
From source file:com.comstar.mars.env.EnvMapperFactoryBean.java
private static Object getRealMapper(String env, Class mapperClazz) { Map<String, Object> mappers = envMappers.get(env); if (mappers.isEmpty()) { return null; }/*w w w . j a va 2s . c o m*/ return mappers.get(mapperClazz.getName()); }
From source file:cc.sion.core.utils.Collections3.java
/** * ?. */ public static boolean isEmpty(Map map) { return (map == null) || map.isEmpty(); }