本文整理汇总了Java中com.google.common.collect.Sets.union方法的典型用法代码示例。如果您正苦于以下问题:Java Sets.union方法的具体用法?Java Sets.union怎么用?Java Sets.union使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Sets
的用法示例。
在下文中一共展示了Sets.union方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: droppingAlso
import com.google.common.collect.Sets; //导入方法依赖的package包/类
/**
* @param extraViewsToDrop Additional views to drop
* @return a new {@link ViewChanges} which also drops the specified views.
*/
public ViewChanges droppingAlso(Collection<View> extraViewsToDrop) {
Set<String> extraViewNames = ImmutableSet.copyOf(Collections2.transform(extraViewsToDrop, viewToName()));
// -- In case we have any new obsolete views in here, we need to make sure they're in the index...
//
Map<String, View> newIndex = new HashMap<>();
newIndex.putAll(uniqueIndex(extraViewsToDrop, viewToName()));
newIndex.putAll(viewIndex);
return new ViewChanges(allViews,
Sets.union(dropSet, extraViewNames),
Sets.union(deploySet, Sets.intersection(extraViewNames, knownSet)),
newIndex);
}
示例2: getLinks
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Set<Link> getLinks(ConnectPoint connectPoint) {
checkPermission(LINK_READ);
checkNotNull(connectPoint, CONNECT_POINT_NULL);
return Sets.union(store.getEgressLinks(connectPoint),
store.getIngressLinks(connectPoint));
}
示例3: copyFallingBackTo
import com.google.common.collect.Sets; //导入方法依赖的package包/类
/**
* Takes this AnswerKey as ground truth, and takes unannotated or assessed Responses in fallback
* and adds them to the AnswerKey.
*
* If the CAS for an AssessedResponse is known, prefer that CAS to the CAS in fallback.
*
* Does not handle the case where the fallback AnswerKey has an Assessment that this AnswerKey
* does not.
*/
public AnswerKey copyFallingBackTo(AnswerKey fallback) {
final Builder ret = modifiedCopyBuilder();
final ImmutableMap<String, Response> unannotatedHere = Maps.uniqueIndex(unannotatedResponses(),
ResponseFunctions.uniqueIdentifier());
final ImmutableMap<String, AssessedResponse> idToAssessedHere =
Maps.uniqueIndex(annotatedResponses(),
Functions.compose(ResponseFunctions.uniqueIdentifier(),
AssessedResponseFunctions.response()));
final Set<String> idsHere = Sets.union(unannotatedHere.keySet(), idToAssessedHere.keySet());
final ImmutableMap<String, Response> unannotatedThere = Maps.uniqueIndex(
fallback.unannotatedResponses(), ResponseFunctions.uniqueIdentifier());
final ImmutableMap<String, AssessedResponse> idToAssessedThere =
Maps.uniqueIndex(fallback.annotatedResponses(),
Functions.compose(ResponseFunctions.uniqueIdentifier(),
AssessedResponseFunctions.response()));
final Set<String> idsThere = Sets.union(unannotatedThere.keySet(), idToAssessedThere.keySet());
final Set<String> idsOnlyInFallback = Sets.difference(idsThere, idsHere);
for (final String id : idsOnlyInFallback) {
if (unannotatedThere.containsKey(id)) {
ret.addUnannotated(unannotatedThere.get(id));
}
if (idToAssessedThere.containsKey(id)) {
final AssessedResponse r = idToAssessedThere.get(id);
final int CASGroup;
if (corefAnnotation().CASesToIDs().containsKey(r.response().canonicalArgument())) {
CASGroup = corefAnnotation().CASesToIDs().get(r.response().canonicalArgument());
} else {
CASGroup = fallback.corefAnnotation().CASesToIDs().get(r.response().canonicalArgument());
}
ret.addAnnotated(r, CASGroup);
}
}
return ret.build();
}
示例4: adjacentEdges
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Set<E> adjacentEdges(E edge) {
EndpointPair<N> endpointPair = incidentNodes(edge); // Verifies that edge is in this network.
Set<E> endpointPairIncidentEdges =
Sets.union(incidentEdges(endpointPair.nodeU()), incidentEdges(endpointPair.nodeV()));
return Sets.difference(endpointPairIncidentEdges, ImmutableSet.of(edge));
}
示例5: getUniqueChild
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public static @Nullable Element getUniqueChild(Element parent, String name, Set<String> aliases) throws InvalidXMLException {
List<Element> children = new ArrayList<>();
for(String alias : Sets.union(ImmutableSet.of(name), aliases)) {
children.addAll(parent.getChildren(alias));
}
if(children.size() > 1) {
throw new InvalidXMLException("multiple '" + name + "' tags not allowed", parent);
}
return children.isEmpty() ? null : children.get(0);
}
示例6: findNodes
import com.google.common.collect.Sets; //导入方法依赖的package包/类
protected Stream<Node> findNodes() {
final Set<String> names = Sets.union(Optionals.toSet(this.name), aliases);
if(names.isEmpty()) {
return Stream.of(Node.of(parent));
}
Stream<Node> nodes = Stream.empty();
if(attributes) {
nodes = Stream.concat(nodes, Node.attributes(parent, names));
}
if(elements) {
nodes = Stream.concat(nodes, Node.elements(parent, names));
}
return nodes;
}
示例7: fromAttr
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public static @Nullable Node fromAttr(Element el, String name, Set<String> aliases) throws InvalidXMLException {
Node node = null;
for(String alias : Sets.union(ImmutableSet.of(name), aliases)) {
node = wrapUnique(node, true, alias, el.getAttribute(alias));
}
return node;
}
示例8: checkCalls
import com.google.common.collect.Sets; //导入方法依赖的package包/类
private void checkCalls(EvaluationResult result) {
final Set<ExpectedRelation> left = new HashSet<>(Sets.union(expectedConstructorCalls, expectedMethodCalls));
result.handleViolations(new ViolationHandler<JavaCall<?>>() {
@Override
public void handle(Collection<JavaCall<?>> violatingObjects, String message) {
removeExpectedAccesses(violatingObjects, left);
}
});
checkEmpty(left);
}
示例9: getPublicSectionNames
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Set<String> getPublicSectionNames() {
// Often fallback will have a section like "translatedlanguagename" that won't be in main. That's fine.
return Sets.union(fallback.getPublicSectionNames(), main.getPublicSectionNames()); // Yes. Use the fallback; using a union is expensive and this is only used in test code for now
}
示例10: add
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public DiscreteResources add(DiscreteResources other) {
Set<DiscreteResource> union = Sets.union(values(), other.values());
return of(parent, union);
}
示例11: allCASes
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public Set<KBPString> allCASes() {
return Sets.union(CASesToIDs.keySet(), unannotatedCASes());
}
示例12: getTableNames
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Set<String> getTableNames() {
return Sets.union(tables.keySet(), getViews());
}
示例13: keySet
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Set<String> keySet() {
return Sets.union(Sets.union(manual.keySet(), Holidays.keys()), permanent().getKeys(false));
}
示例14: adjacentNodes
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Set<N> adjacentNodes() {
return Sets.union(predecessors(), successors());
}
示例15: keySet
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Set<K> keySet() {
return Sets.union(map.keySet(), parent.keySet());
}