当前位置: 首页>>代码示例>>Java>>正文


Java Map.isEmpty方法代码示例

本文整理汇总了Java中java.util.Map.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Map.isEmpty方法的具体用法?Java Map.isEmpty怎么用?Java Map.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Map的用法示例。


在下文中一共展示了Map.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: a

import java.util.Map; //导入方法依赖的package包/类
private boolean a(Map<String, Object> map) {
    if (map == null || map.isEmpty()) {
        bv.f("map is null or empty in onEvent");
        return false;
    }
    for (Entry entry : map.entrySet()) {
        if (!a((String) entry.getKey())) {
            return false;
        }
        if (entry.getValue() == null) {
            return false;
        }
        if ((entry.getValue() instanceof String) && !b(entry.getValue().toString())) {
            return false;
        }
    }
    return true;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:19,代码来源:o.java

示例2: append

import java.util.Map; //导入方法依赖的package包/类
/**
 * Append given map as query parameters to the base URL
 * <p>
 * Each map entry's key will be a parameter name and the value's
 * {@link Object#toString()} will be the parameter value.
 *
 * @param url
 * @param params
 * @return URL with appended query params
 */
public static String append(final CharSequence url, final Map<?, ?> params) {
  final String baseUrl = url.toString();
  if (params == null || params.isEmpty())
    return baseUrl;

  final StringBuilder result = new StringBuilder(baseUrl);

  addPathSeparator(baseUrl, result);
  addParamPrefix(baseUrl, result);

  Entry<?, ?> entry;
  Iterator<?> iterator = params.entrySet().iterator();
  entry = (Entry<?, ?>) iterator.next();
  addParam(entry.getKey().toString(), entry.getValue(), result);

  while (iterator.hasNext()) {
    result.append('&');
    entry = (Entry<?, ?>) iterator.next();
    addParam(entry.getKey().toString(), entry.getValue(), result);
  }

  return result.toString();
}
 
开发者ID:auv1107,项目名称:TextEmoji,代码行数:34,代码来源:HttpRequest.java

示例3: onBucketsUpdated

import java.util.Map; //导入方法依赖的package包/类
@Override
protected void onBucketsUpdated(final Map<Address, Bucket<RoutingTable>> buckets) {
    final Map<Address, Optional<RemoteRpcEndpoint>> endpoints = new HashMap<>(buckets.size());

    for (Entry<Address, Bucket<RoutingTable>> e : buckets.entrySet()) {
        final RoutingTable table = e.getValue().getData();

        final Collection<DOMRpcIdentifier> rpcs = table.getRoutes();
        endpoints.put(e.getKey(), rpcs.isEmpty() ? Optional.empty()
                : Optional.of(new RemoteRpcEndpoint(table.getRpcInvoker(), rpcs)));
    }

    if (!endpoints.isEmpty()) {
        rpcRegistrar.tell(new UpdateRemoteEndpoints(endpoints), ActorRef.noSender());
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:RpcRegistry.java

示例4: getSpaceToFileIds

import java.util.Map; //导入方法依赖的package包/类
private Map<String, List<String>> getSpaceToFileIds(Map<String, List<String>> spaceToProcessIds,
    Map<String, String> processIdToAppArchiveId) {
    if (spaceToProcessIds.isEmpty()) {
        return Collections.emptyMap();
    }
    Map<String, List<String>> spaceToFileIds = new HashMap<String, List<String>>();
    for (String space : spaceToProcessIds.keySet()) {
        if (spaceToProcessIds.get(space) == null) {
            continue;
        }
        List<String> fileIds = new ArrayList<String>();
        for (String processId : spaceToProcessIds.get(space)) {
            if (processIdToAppArchiveId.containsKey(processId)) {
                fileIds.add(processIdToAppArchiveId.get(processId));
            }
        }
        spaceToFileIds.put(space, fileIds);
    }
    return spaceToFileIds;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:21,代码来源:CleanUpJob.java

示例5: getItemProperty

import java.util.Map; //导入方法依赖的package包/类
protected static <T> PropertyResult<T> getItemProperty(final String propertyName, final Fibre fibre,
        final OperationContext context) {

    T mappedValue = (T) ((Item) fibre).getPropertyValueForName(propertyName);
    if (mappedValue != null) {
        return new PropertyResult<T>(true, mappedValue);
    }

    Map<String, Item> relatedItemsMap = ((Item) fibre).getConnectedRelationships().get(propertyName);

    if (relatedItemsMap == null) {
        return new PropertyResult<T>(false, null); // Not a known relationship

    }
    if (relatedItemsMap.isEmpty()) {
        return new PropertyResult<T>(true, null); // No relationships
    }

    T readValue = (relatedItemsMap.size() == 1) ? (T) relatedItemsMap.values().iterator().next() : // return
                                                                                                   // the
                                                                                                   // related
                                                                                                   // Item
            (T) relatedItemsMap.values(); // return the collection of related Items

    return new PropertyResult<T>(true, readValue);
}
 
开发者ID:HewlettPackard,项目名称:loom,代码行数:27,代码来源:FibreIntrospectionUtils.java

示例6: GrafanaHttpCallBack

import java.util.Map; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public GrafanaHttpCallBack(Map _params, CountDownLatch latch) {
    if (null != _params && !_params.isEmpty()) {
        this.params.putAll(_params);
    }
    this.latch = latch;
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:8,代码来源:GrafanaHttpCallBack.java

示例7: validatePrivate

import java.util.Map; //导入方法依赖的package包/类
private boolean validatePrivate(SectionInfo info, EntityEditingSession<B, E> session)
{
	final Map<String, Object> errors = session.getValidationErrors();
	errors.clear();

	final LanguageBundleBean bundle = title.getLanguageBundle(info);
	if( LangUtils.isEmpty(bundle) )
	{
		errors.put(KEY_ERROR_TITLE, getTitleMandatoryErrorLabel().getText());
	}

	validate(info, session);
	return errors.isEmpty();
}
 
开发者ID:equella,项目名称:Equella,代码行数:15,代码来源:AbstractEntityEditor.java

示例8: DictionaryCompoundWordTokenFilterFactory

import java.util.Map; //导入方法依赖的package包/类
/** Creates a new DictionaryCompoundWordTokenFilterFactory */
public DictionaryCompoundWordTokenFilterFactory(Map<String, String> args) {
  super(args);
  assureMatchVersion();
  dictFile = require(args, "dictionary");
  minWordSize = getInt(args, "minWordSize", CompoundWordTokenFilterBase.DEFAULT_MIN_WORD_SIZE);
  minSubwordSize = getInt(args, "minSubwordSize", CompoundWordTokenFilterBase.DEFAULT_MIN_SUBWORD_SIZE);
  maxSubwordSize = getInt(args, "maxSubwordSize", CompoundWordTokenFilterBase.DEFAULT_MAX_SUBWORD_SIZE);
  onlyLongestMatch = getBoolean(args, "onlyLongestMatch", true);
  if (!args.isEmpty()) {
    throw new IllegalArgumentException("Unknown parameters: " + args);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:DictionaryCompoundWordTokenFilterFactory.java

示例9: fromMap

import java.util.Map; //导入方法依赖的package包/类
public static CompressionParams fromMap(Map<String, String> opts)
{
    Map<String, String> options = copyOptions(opts);

    String sstableCompressionClass;

    if (!opts.isEmpty() && isEnabled(opts) && !containsSstableCompressionClass(opts))
        throw new ConfigurationException(format("Missing sub-option '%s' for the 'compression' option.", CLASS));

    if (!removeEnabled(options))
    {
        sstableCompressionClass = null;

        if (!options.isEmpty())
            throw new ConfigurationException(format("If the '%s' option is set to false no other options must be specified", ENABLED));
    }
    else
    {
        sstableCompressionClass = removeSstableCompressionClass(options);
    }

    Integer chunkLength = removeChunkLength(options);

    CompressionParams cp = new CompressionParams(sstableCompressionClass, chunkLength, options);
    cp.validate();

    return cp;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:29,代码来源:CompressionParams.java

示例10: deserialize

import java.util.Map; //导入方法依赖的package包/类
public ModelBlockDefinition deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = p_deserialize_1_.getAsJsonObject();
    Map<String, VariantList> map = this.parseMapVariants(p_deserialize_3_, jsonobject);
    Multipart multipart = this.parseMultipart(p_deserialize_3_, jsonobject);

    if (!map.isEmpty() || multipart != null && !multipart.getVariants().isEmpty())
    {
        return new ModelBlockDefinition(map, multipart);
    }
    else
    {
        throw new JsonParseException("Neither \'variants\' nor \'multipart\' found");
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:16,代码来源:ModelBlockDefinition.java

示例11: HyphenatedWordsFilterFactory

import java.util.Map; //导入方法依赖的package包/类
/** Creates a new HyphenatedWordsFilterFactory */
public HyphenatedWordsFilterFactory(Map<String,String> args) {
  super(args);
  if (!args.isEmpty()) {
    throw new IllegalArgumentException("Unknown parameters: " + args);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:HyphenatedWordsFilterFactory.java

示例12: deleteSvTapStep

import java.util.Map; //导入方法依赖的package包/类
/**
 * Utility to properly delete a SvTapStep instance given its id
 *
 * @param id
 *            Id of the instance to delete
 * @return a boolean indicating if the instance has been correctly found
 *         and deleted
 */
public boolean deleteSvTapStep(final String id) {

    if (subsetsInstances.containsKey(
            Subset.StateVariables)) {
        Map<String, CIMInstance> instances = subsetsInstances.get(
                Subset.StateVariables);

        if (instances.containsKey(id)) {
            // The instance is being deleted
            LOGGER.debug("The instance '" + id + "' is being deleted");
            subsetsInstances
                    .get(Subset.StateVariables)
                    .remove(id);
            if (instances.isEmpty()) {
                // If there is no more class belonging to that
                // subset, we unload it
                setUnloaded(Subset.Equipment);
                // Are we back in a "merged" state ?
                this.currentSubsetSet = this.loadedSubsets.isEmpty();
            }

        }

        // We clear among the "id_SvTapStep" map
        id_SvTapStep.remove(id);

        // We clear among the "allinstances" map
        allInstances.remove(id);
        return true;
    }

    return false;
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:42,代码来源:CIMModel.java

示例13: getSitesPerHost

import java.util.Map; //导入方法依赖的package包/类
/**
 * Get a mapping of sites for each host. We have to return the Site objects
 * in order to get the Partition handle that we want
 * 
 * @return
 */
public static synchronized Map<Host, Set<Site>> getSitesPerHost(CatalogType catalog_item) {
    final CatalogUtil.Cache cache = CatalogUtil.getCatalogCache(catalog_item);
    final Map<Host, Set<Site>> sites = cache.HOST_SITES;

    if (sites.isEmpty()) {
        // Sort them by site ids
        final Comparator<Site> comparator = new Comparator<Site>() {
            @Override
            public int compare(Site o1, Site o2) {
                return (o1.getId() - o2.getId());
            }
        };

        Cluster catalog_clus = CatalogUtil.getCluster(catalog_item);
        for (Site catalog_site : catalog_clus.getSites()) {
            Host catalog_host = catalog_site.getHost();
            if (!sites.containsKey(catalog_host)) {
                sites.put(catalog_host, new TreeSet<Site>(comparator));
            }
            sites.get(catalog_host).add(catalog_site);
            if (debug.val)
                LOG.debug(catalog_host + " => " + catalog_site);
        } // FOR
        assert (sites.size() == catalog_clus.getHosts().size());
        if (debug.val)
            LOG.debug("HOST SITES: " + sites);
    }
    return (sites);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:36,代码来源:CatalogUtil.java

示例14: addPrincipalAttributesIntoCache

import java.util.Map; //导入方法依赖的package包/类
/**
 * Set/add the received attributes into the cache.
 * @param id the principal id that controls the grouping of the attributes in the cache.
 * @param attributes principal attributes to add to the cache
 */
private void addPrincipalAttributesIntoCache(final String id, final Map<String, Object> attributes) {
    synchronized (this.cache) {
        if (attributes.isEmpty()) {

            this.cache.remove(id);
            LOGGER.debug("No attributes are provided, so removed principal id [{}] from the cache", id);
        } else {
            this.cache.put(id, attributes);
            LOGGER.debug("Cached [{}] attributes for the principal id [{}]", attributes.size(), id);
        }
    }
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:18,代码来源:CachingPrincipalAttributesRepository.java

示例15: getLang

import java.util.Map; //导入方法依赖的package包/类
public Map<String, String> getLang(Locale currentLocale) {
	Map<String, String> lang = langutils.readLanguage(currentLocale.getLanguage());
	if (lang == null || lang.isEmpty()) {
		lang = langutils.getDefaultLanguage();
	}
	return lang;
}
 
开发者ID:Erudika,项目名称:scoold,代码行数:8,代码来源:ScooldUtils.java


注:本文中的java.util.Map.isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。