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


Java Sets.union方法代码示例

本文整理汇总了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);
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:19,代码来源:ViewChanges.java

示例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));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:LinkManager.java

示例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();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:47,代码来源:AnswerKey.java

示例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));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:8,代码来源:AbstractNetwork.java

示例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);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:12,代码来源:XMLUtils.java

示例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;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:16,代码来源:PropertyBuilder.java

示例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;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:8,代码来源:Node.java

示例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);
}
 
开发者ID:TNG,项目名称:ArchUnit,代码行数:11,代码来源:HandlingAssertion.java

示例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
}
 
开发者ID:salesforce,项目名称:grammaticus,代码行数:6,代码来源:GrammaticalLabelSetFallbackImpl.java

示例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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:7,代码来源:EncodableDiscreteResources.java

示例11: allCASes

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public Set<KBPString> allCASes() {
  return Sets.union(CASesToIDs.keySet(), unannotatedCASes());
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:4,代码来源:CorefAnnotation.java

示例12: getTableNames

import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Set<String> getTableNames() {
  return Sets.union(tables.keySet(), getViews());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:WorkspaceSchemaFactory.java

示例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));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:PGMMapEnvironment.java

示例14: adjacentNodes

import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Set<N> adjacentNodes() {
  return Sets.union(predecessors(), successors());
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:5,代码来源:AbstractDirectedNetworkConnections.java

示例15: keySet

import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Set<K> keySet() {
    return Sets.union(map.keySet(), parent.keySet());
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:InheritingMap.java


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