本文整理匯總了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;
}
示例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();
}
示例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());
}
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
}
示例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;
}
示例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");
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}