本文整理了Java中java.util.HashSet.retainAll()
方法的一些代码示例,展示了HashSet.retainAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HashSet.retainAll()
方法的具体详情如下:
包路径:java.util.HashSet
类名称:HashSet
方法名:retainAll
暂无
代码示例来源:origin: org.mockito/mockito-core
public boolean retainAll(Collection<?> mocks) {
return backingHashSet.retainAll(asWrappedMocks(mocks));
}
代码示例来源:origin: google/j2objc
public boolean retainAll(Collection<?> mocks) {
return backingHashSet.retainAll(asWrappedMocks(mocks));
}
代码示例来源:origin: Sable/soot
/**
* @ast method
* @aspect GenericMethodsInference
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/GenericMethodsInference.jrag:668
*/
public static HashSet EC(ArrayList list) {
HashSet result = new HashSet();
boolean first = true;
for(Iterator iter = list.iterator(); iter.hasNext(); ) {
TypeDecl U = (TypeDecl)iter.next();
// erased supertype set of U
HashSet EST = LUBType.EST(U);
if(first) {
result.addAll(EST);
first = false;
}
else
result.retainAll(EST);
}
return result;
}
/**
代码示例来源:origin: commonsguy/cw-omnibus
intersection.retainAll(previous.apps.keySet());
代码示例来源:origin: fesh0r/fernflower
private void splitJsrExceptionRanges(Set<BasicBlock> common_blocks, Map<Integer, BasicBlock> mapNewNodes) {
for (int i = exceptions.size() - 1; i >= 0; i--) {
ExceptionRangeCFG range = exceptions.get(i);
List<BasicBlock> lstRange = range.getProtectedRange();
HashSet<BasicBlock> setBoth = new HashSet<>(common_blocks);
setBoth.retainAll(lstRange);
if (setBoth.size() > 0) {
List<BasicBlock> lstNewRange;
if (setBoth.size() == lstRange.size()) {
lstNewRange = new ArrayList<>();
ExceptionRangeCFG newRange = new ExceptionRangeCFG(lstNewRange,
mapNewNodes.get(range.getHandler().id), range.getExceptionTypes());
exceptions.add(newRange);
}
else {
lstNewRange = lstRange;
}
for (BasicBlock block : setBoth) {
lstNewRange.add(mapNewNodes.get(block.id));
}
}
}
}
代码示例来源:origin: spotbugs/spotbugs
/**
* Do any prep work needed to perform bug filtering
*
* @param origCollection
*/
public void getReady(SortedBugCollection origCollection) {
if (maybeMutatedAsString != null) {
HashSet<String> addedIssues = new HashSet<>();
HashSet<String> removedIssues = new HashSet<>();
for (BugInstance b : origCollection) {
if (b.getFirstVersion() == maybeMutated) {
addedIssues.add(getBugLocation(b));
} else if (b.getLastVersion() == maybeMutated - 1) {
removedIssues.add(getBugLocation(b));
}
}
addedIssues.remove(null);
addedIssues.retainAll(removedIssues);
mutationPoints = addedIssues;
}
}
代码示例来源:origin: apache/zookeeper
for (Proposal.QuorumVerifierAcksetPair qvAckset: p.qvAcksetPairs){
candidates.retainAll(qvAckset.getAckset());
代码示例来源:origin: spotbugs/spotbugs
both.retainAll(oEdges.get(e));
for (E e2 : both) {
iEdges.remove(e, e2);
代码示例来源:origin: org.apache.commons/commons-lang3
testLocales.retainAll(Arrays.asList(NumberFormat.getAvailableLocales()));
testLocales.add(null);
代码示例来源:origin: apache/geode
recipients.retainAll(this.dm.getDistributionManagerIds());
if (!recipients.isEmpty()) {
if (this.txState.internalDuringIndividualSend != null) {
代码示例来源:origin: spotbugs/spotbugs
private void pruneConflictingValues(TypeQualifierValueSet fact, TypeQualifierValueSet forwardFact) {
if (forwardFact.isValid()) {
HashSet<ValueNumber> valueNumbers = new HashSet<>();
valueNumbers.addAll(fact.getValueNumbers());
valueNumbers.retainAll(forwardFact.getValueNumbers());
for (ValueNumber vn : valueNumbers) {
if (FlowValue.valuesConflict(typeQualifierValue.isStrictQualifier() && !xmethod.isIdentity(),
forwardFact.getValue(vn), fact.getValue(vn))) {
fact.pruneValue(vn);
}
}
}
}
代码示例来源:origin: ehcache/ehcache3
clusteredResourceTypes.retainAll(CLUSTER_RESOURCES);
代码示例来源:origin: fesh0r/fernflower
setCommonExceptionHandlers.retainAll(pred.getSuccExceptions());
代码示例来源:origin: fesh0r/fernflower
setPredHandlersIntersection.retainAll(pred.getSuccExceptions());
代码示例来源:origin: lenskit/lenskit
GraphDumper(DAGNode<Component, Dependency> g, Set<DAGNode<Component, Dependency>> unshared, GraphWriter gw) {
writer = gw;
graph = g;
unsharedNodes = Sets.newHashSet(unshared);
unsharedNodes.retainAll(g.getReachableNodes());
logger.debug("{} shared nodes", unsharedNodes.size());
nodeIds = new HashMap<>();
nodeTargets = new HashMap<>();
edgeQueue = new LinkedList<>();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
candidateSet = thisWordChoices;
} else {
candidateSet.retainAll(thisWordChoices);
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Validates only 1 vertex is tangential (shared) between the interior and exterior of a polygon
*/
protected void validateHole(LineStringBuilder shell, LineStringBuilder hole) {
HashSet<Coordinate> exterior = Sets.newHashSet(shell.coordinates);
HashSet<Coordinate> interior = Sets.newHashSet(hole.coordinates);
exterior.retainAll(interior);
if (exterior.size() >= 2) {
throw new InvalidShapeException("Invalid polygon, interior cannot share more than one point with the exterior");
}
}
代码示例来源:origin: GoogleCloudPlatform/java-docs-samples
/**
* Looks up the set of documents containing each word. Returns the intersection of these.
*/
public ImmutableSet<String> lookup(Iterable<String> words) {
HashSet<String> documents = null;
try (Jedis jedis = pool.getResource()) {
jedis.select(TOKEN_DB);
for (String word : words) {
word = stemmer.stem(word.toLowerCase()).toString();
if (documents == null) {
documents = new HashSet();
documents.addAll(jedis.smembers(word));
} else {
documents.retainAll(jedis.smembers(word));
}
}
}
if (documents == null) {
return ImmutableSet.<String>of();
}
return ImmutableSet.<String>copyOf(documents);
}
代码示例来源:origin: apache/accumulo
if (!Collections.disjoint(columnFamilies, previousColumnFamilies)) {
HashSet<ByteSequence> overlap = new HashSet<>(columnFamilies);
overlap.retainAll(previousColumnFamilies);
throw new IllegalArgumentException(
"Column families over lap with previous locality group : " + overlap);
代码示例来源:origin: org.apache.commons/commons-text
testLocales.retainAll(Arrays.asList(NumberFormat.getAvailableLocales()));
testLocales.add(null);
内容来源于网络,如有侵权,请联系作者删除!