當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。