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


Java Set.isEmpty方法代码示例

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


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

示例1: send

import java.util.Set; //导入方法依赖的package包/类
/**
 * Send a profile update to a set of members.
 * 
 * @param recipients the set of members to be notified
 * @param dm the distribution manager used to send the message
 * @param prId the unique partitioned region identifier
 * @param bucketId the unique bucket identifier
 * @param bp the updated bucket profile to send
 * @param requireAck whether or not to expect a reply
 * @return an instance of reply processor if requireAck is true on which the caller can wait until
 *         the event has finished.
 */
public static ReplyProcessor21 send(Set recipients, DM dm, int prId, int bucketId,
    BucketProfile bp, boolean requireAck) {
  if (recipients.isEmpty()) {
    return null;
  }
  ReplyProcessor21 rp = null;
  int procId = 0;
  if (requireAck) {
    rp = new ReplyProcessor21(dm, recipients);
    procId = rp.getProcessorId();
  }
  BucketProfileUpdateMessage m =
      new BucketProfileUpdateMessage(recipients, prId, procId, bucketId, bp);
  dm.putOutgoing(m);
  return rp;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:29,代码来源:BucketProfileUpdateMessage.java

示例2: removeKey

import java.util.Set; //导入方法依赖的package包/类
@Override
public void removeKey(Object key) {

    // FIXME Make the cast more safe - we should never throw an exception
    K prefKey = getPrefKey((K)key);
    Set<K> altKeys = prefKeyToAltKeysWithIso.row(prefKey).keySet();

    // Remove the key from the alt keys
    altKeys.remove(key);

    // If the prefKey no longer has any alt keys, remove all nodes associated with that key
    boolean extinguishNodes = altKeys.isEmpty();

    if(extinguishNodes) {
        IndexNode<K, G, V, T> node = keyToNode.get(prefKey);
        extinguishNode(node);
    }
}
 
开发者ID:SmartDataAnalytics,项目名称:SubgraphIsomorphismIndex,代码行数:19,代码来源:SubgraphIsomorphismIndexImpl.java

示例3: main

import java.util.Set; //导入方法依赖的package包/类
public static void main(String... args) {
    Set<String> hashedModules = hashedModules();
    if (hashedModules.isEmpty())
        return;

    if (UPGRADEABLE_MODULES.stream().anyMatch(hashedModules::contains)) {
        throw new RuntimeException("upgradeable modules are hashed: " +
            UPGRADEABLE_MODULES.stream()
                .filter(hashedModules::contains)
                .collect(Collectors.joining(" ")));
    }

    Set<String> nonUpgradeableModules =
        ModuleFinder.ofSystem().findAll().stream()
            .map(mref -> mref.descriptor().name())
            .filter(mn -> !UPGRADEABLE_MODULES.contains(mn))
            .collect(Collectors.toSet());

    if (nonUpgradeableModules.stream().anyMatch(mn -> !hashedModules.contains(mn))) {
        throw new RuntimeException("non-upgradeable modules are not hashed: " +
            nonUpgradeableModules.stream()
                .filter(mn -> !hashedModules.contains(mn))
                .collect(Collectors.joining(" ")));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:UpgradeableModules.java

示例4: simplifyVcfIndexEntries

import java.util.Set; //导入方法依赖的package包/类
private List<VcfIndexEntry> simplifyVcfIndexEntries(VcfIndexEntry masterEntry, VariantContext context,
                                                    Set<VariationGeneInfo> geneIds, Set<VariationType> types,
                                                    String geneIdsString, String geneNamesString) {
    List<VcfIndexEntry> simplifiedEntries = new ArrayList<>();
    for (VariationType type : types) {
        if (geneIds.isEmpty()) {
            if (context.getFilters().isEmpty()) {
                VcfIndexEntry entry = new VcfIndexEntry(masterEntry);
                entry.setVariationType(type);

                simplifiedEntries.add(entry);
            } else {
                simplifyFilters(masterEntry, context, simplifiedEntries, type);
            }
        } else {
            simplifyGeneIds(masterEntry, context, geneIds, geneIdsString, geneNamesString, simplifiedEntries, type);
        }
    }

    return simplifiedEntries;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:22,代码来源:FeatureIndexManager.java

示例5: fetchSubscribeMessageQueues

import java.util.Set; //导入方法依赖的package包/类
public Set<MessageQueue> fetchSubscribeMessageQueues(String topic) throws MQClientException {
    try {
        TopicRouteData topicRouteData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, timeoutMillis);
        if (topicRouteData != null) {
            Set<MessageQueue> mqList = MQClientInstance.topicRouteData2TopicSubscribeInfo(topic, topicRouteData);
            if (!mqList.isEmpty()) {
                return mqList;
            }
            else {
                throw new MQClientException("Can not find Message Queue for this topic, " + topic + " Namesrv return empty", null);
            }
        }
    }
    catch (Exception e) {
        throw new MQClientException(
            "Can not find Message Queue for this topic, " + topic + FAQUrl.suggestTodo(FAQUrl.MQLIST_NOT_EXIST), //
            e);
    }

    throw new MQClientException("Unknow why, Can not find Message Queue for this topic, " + topic, null);
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:22,代码来源:MQAdminImpl.java

示例6: analyzeClassesForUselessInit

import java.util.Set; //导入方法依赖的package包/类
private void analyzeClassesForUselessInit(String dir, Set<String> classesToVisit)
		throws IOException, XMLStreamException {
	final UselessInitClassVisitor uselessInitClassVisitor = Factory
			.createUselessInitClassVisitor();
	for (final String className : classesToVisit) {
		if (isInterrupted()) {
			break;
		}
		final ClassReader classReader = createClassReader(dir, className);
		classReader.accept(uselessInitClassVisitor,
				ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
		final Set<String> positiveFields = uselessInitClassVisitor.positiveFields;
		if (!positiveFields.isEmpty()) {
			// les classes *ServiceLocator générées par Apache Axis
			// contiennent une initialisation "ports" inutile,
			// mais il est inutile de le signaler puisque c'est généré par Axis
			if (className.endsWith("ServiceLocator") && positiveFields.size() == 1
					&& positiveFields.contains("ports")) {
				continue;
			}
			report.reportUselessInitializations(className, positiveFields);
			suspectCount += positiveFields.size();
		}
	}
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:26,代码来源:DeadCodeDetector.java

示例7: _addTargets

import java.util.Set; //导入方法依赖的package包/类
private void _addTargets(
  UIComponent      key,
  Set<UIComponent> visitedComponents)
{
  Map<UIComponent, Set<UIComponent>> pl = _getPartialListeners();
  Set<UIComponent> listeners = pl.get(key);
  if (listeners != null && !listeners.isEmpty())
  {
    // protect from infinite recursion by making sure we do not
    // process the same component twice
    if (!visitedComponents.add(key))
    {
      return;
    }

    for (UIComponent listener : listeners)
    {
      addPartialTarget(listener);
      // This target will be re-rendered, re-render anything that's
      // listening on it also.
      _addTargets(listener, visitedComponents);
    }
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:25,代码来源:RequestContextImpl.java

示例8: incrementalProcess

import java.util.Set; //导入方法依赖的package包/类
@Override
public boolean incrementalProcess(
        Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    for (TypeElement annotation : annotations) {
        System.out.println("Processing annotation:" + annotation);
    }

    // generates a class with a constant that contains the name of all classes containing an annotation.
    Set<? extends Element> elementsAnnotatedWith =
            roundEnv.getElementsAnnotatedWith(Annotation1.class);
    if (elementsAnnotatedWith.isEmpty()) {
        return false;
    }
    Set<String> nameOfClassesContainingAnnotation1 = new HashSet<>();
    processElements(elementsAnnotatedWith, nameOfClassesContainingAnnotation1);
    String generatedClassName = "GeneratedFoo";
    writeGeneratedFile(
            elementsAnnotatedWith, nameOfClassesContainingAnnotation1, generatedClassName);
    return false;
}
 
开发者ID:gradle,项目名称:incap,代码行数:21,代码来源:Processor1.java

示例9: matchStack

import java.util.Set; //导入方法依赖的package包/类
private boolean matchStack(ItemStack stack, Set<Integer> ores, ItemStack s) {
    if (ItemStackTools.isValid(s)) {
        if (s.getItem() == stack.getItem()) {
            return true;
        }
        if (!ores.isEmpty()) {
            int[] iDs = OreDictionary.getOreIDs(s);
            for (int d : iDs) {
                if (ores.contains(d)) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
开发者ID:McJty,项目名称:interactionwheel,代码行数:17,代码来源:DumpSimilarInventoryAction.java

示例10: compare

import java.util.Set; //导入方法依赖的package包/类
@Override
public float compare(Set<T> a, Set<T> b) {

	if (a.isEmpty() && b.isEmpty()) {
		return 1.0f;
	}

	if (a.isEmpty() || b.isEmpty()) {
		return 0.0f;
	}

	// ∣q ∩ r∣ / min{∣q∣, ∣r∣}
	return intersection(a, b).size() / (float) min(a.size(), b.size());
}
 
开发者ID:janmotl,项目名称:linkifier,代码行数:15,代码来源:OverlapCoefficient.java

示例11: remove

import java.util.Set; //导入方法依赖的package包/类
public synchronized void remove(Class<?> cls, int begin, int end, T item)
{
	SortedMap<Integer, SortedMap<Integer, Set<T>>> clsMap = map.get(cls);
	if (null==clsMap) {throw new DapException("Tried to remove an item that does not exist.");}
	SortedMap<Integer, Set<T>> beginMap = clsMap.get(begin);
	if (null==beginMap) {throw new DapException("Tried to remove an item that does not exist.");}
	Set<T> items = beginMap.get(end);
	if (null==items) {throw new DapException("Tried to remove an item that does not exist.");}
	for (T anItem : items)
	{
		if (item.getUniqueId()==anItem.getUniqueId())
		{
			items.remove(anItem);
		}
	}
	
	if (items.isEmpty())
	{
		beginMap.remove(end);
	}
	if (beginMap.isEmpty())
	{
		clsMap.remove(begin);
	}
	if (clsMap.isEmpty())
	{
		map.remove(cls);
	}
}
 
开发者ID:document-analysis,项目名称:dap,代码行数:30,代码来源:Index.java

示例12: waitForUnfinishedTasks

import java.util.Set; //导入方法依赖的package包/类
public void waitForUnfinishedTasks(long timeout) throws InterruptedException {
    Set<Task> tasks = new HashSet<Task>();
    synchronized (unfinishedTasks) {
        tasks.addAll(unfinishedTasks);
    }
    while (!tasks.isEmpty()) {
        Task task = tasks.iterator().next();
        task.waitFinished(timeout);
        tasks.remove(task);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:DeadlockDetectorImpl.java

示例13: detectCycle

import java.util.Set; //导入方法依赖的package包/类
private void detectCycle(SingleLeafDirectedAcyclicGraph<SagaRequest> graph) {
  Set<Node<SagaRequest>> jointNodes = detector.cycleJoints(graph);

  if (!jointNodes.isEmpty()) {
    throw new SagaException("Cycle detected in the request graph at nodes " + jointNodes);
  }
}
 
开发者ID:apache,项目名称:incubator-servicecomb-saga,代码行数:8,代码来源:GraphBuilder.java

示例14: reportDeadCodeSuspects

import java.util.Set; //导入方法依赖的package包/类
void reportDeadCodeSuspects(boolean publicDeadCode, String asmClassName, Set<String> descs)
		throws XMLStreamException {
	if (descs.isEmpty()) {
		// analyzeViewFiles peut avoir laisser des listes vides
		return;
	}
	final String type = publicDeadCode ? "publicDeadCode" : "privateDeadCode";
	final String className = Type.getObjectType(asmClassName).getClassName();
	final String msg = (publicDeadCode ? "Public suspects in class "
			: "Private suspects in class ") + className + ':';
	final String msg2 = '\t' + descs.toString();
	reportWarning(type, className, msg, msg2);
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:14,代码来源:Report.java

示例15: smallSet

import java.util.Set; //导入方法依赖的package包/类
private static <T> Set<T> smallSet(final Set<T> set) {
    if (set == null || set.isEmpty()) {
        return Collections.emptySet();
    } else if (set.size() == 1) {
        return Collections.singleton(set.iterator().next());
    } else {
        return set;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:RecompilableScriptFunctionData.java


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