Example usage for com.google.common.collect Sets union

List of usage examples for com.google.common.collect Sets union

Introduction

In this page you can find the example usage for com.google.common.collect Sets union.

Prototype

public static <E> SetView<E> union(final Set<? extends E> set1, final Set<? extends E> set2) 

Source Link

Document

Returns an unmodifiable view of the union of two sets.

Usage

From source file:com.google.template.soy.data.internal.AugmentedSoyMapData.java

@Override
public Set<String> getKeys() {
    return Collections.unmodifiableSet(Sets.union(super.getKeys(), baseData.getKeys()));
}

From source file:org.opendaylight.yangtools.yang.data.impl.schema.tree.CaseEnforcer.java

Set<PathArgument> getAllChildIdentifiers() {
    return Sets.union(children.keySet(), augmentations.keySet());
}

From source file:org.n52.iceland.i18n.metadata.AbstractI18NMetadata.java

/**
 * @return a unmodifiable set of all {@link Locale}s present in this object.
 *//*  ww w  . j a  v  a2  s  .  c  om*/
public Set<Locale> getLocales() {
    return Sets.union(getName().getLocales(), getDescription().getLocales());
}

From source file:com.facebook.buck.rules.DescribedRuleBuilder.java

@Override
public Set<BuildTarget> getDeps() {
    return Sets.union(extraDeps, declaredDeps);
}

From source file:org.agatom.springatom.data.hades.model.person.NPerson.java

public boolean removeContact(final Collection<NPersonContact> contacts) {
    if (contacts.size() > 0 && this.contacts != null) {
        final Set<NPersonContact> thisContacts = Sets.newHashSet(this.getContacts());
        final Set<NPersonContact> contactSet = Sets.newHashSet(contacts);
        final Set<NPersonContact> difference = Sets.union(thisContacts, contactSet).immutableCopy();
        return this.contacts.removeAll(difference);
    }/*from w  w  w. j a v  a2s .co  m*/
    return false;
}

From source file:piecework.persistence.concrete.SearchRepositoryProvider.java

@Override
public SearchResults facets(String label, ViewContext context) throws PieceworkException {
    Set<String> overseerProcessDefinitionKeys = principal.getProcessDefinitionKeys(AuthorizationRole.OVERSEER);
    Set<String> userProcessDefinitionKeys = principal.getProcessDefinitionKeys(AuthorizationRole.USER);

    Set<String> allProcessDefinitionKeys = Sets.union(overseerProcessDefinitionKeys, userProcessDefinitionKeys);
    Set<piecework.model.Process> allowedProcesses = processes(allProcessDefinitionKeys);

    List<Facet> facets = FacetFactory.facets(allowedProcesses);

    return new SearchResults.Builder().items(facets).total(Long.valueOf(facets.size())).build();
}

From source file:org.jetbrains.jet.lang.resolve.calls.smartcasts.DelegatingDataFlowInfo.java

@Override
@NotNull// w w  w.j a  v a2 s. c o m
public Set<JetType> getPossibleTypes(@NotNull DataFlowValue key) {
    Set<JetType> theseTypes = typeInfo.get(key);
    Set<JetType> types = parent == null ? theseTypes : Sets.union(theseTypes, parent.getPossibleTypes(key));
    if (getNullability(key).canBeNull()) {
        return types;
    }

    Set<JetType> enrichedTypes = Sets.newHashSetWithExpectedSize(types.size() + 1);
    JetType originalType = key.getType();
    if (originalType.isNullable()) {
        enrichedTypes.add(TypeUtils.makeNotNullable(originalType));
    }
    for (JetType type : types) {
        enrichedTypes.add(TypeUtils.makeNotNullable(type));
    }

    return enrichedTypes;
}

From source file:org.apache.beam.runners.fnexecution.wire.LengthPrefixUnknownCoders.java

private static MessageWithComponents lengthPrefixUnknownComponentCoders(String coderId,
        RunnerApi.Components components, boolean replaceWithByteArrayCoder) {

    MessageWithComponents.Builder rvalBuilder = MessageWithComponents.newBuilder();
    RunnerApi.Coder currentCoder = components.getCodersOrThrow(coderId);
    RunnerApi.Coder.Builder updatedCoder = currentCoder.toBuilder();
    // Rebuild the component coder ids to handle if any of the component coders changed.
    updatedCoder.clearComponentCoderIds();
    for (final String componentCoderId : currentCoder.getComponentCoderIdsList()) {
        MessageWithComponents componentCoder = forCoder(componentCoderId, components,
                replaceWithByteArrayCoder);
        String newComponentCoderId = componentCoderId;
        if (!components.getCodersOrThrow(componentCoderId).equals(componentCoder.getCoder())) {
            // Generate a new id if the component coder changed.
            newComponentCoderId = generateUniqueId(coderId + "-length_prefix", Sets.union(
                    components.getCodersMap().keySet(), rvalBuilder.getComponents().getCodersMap().keySet()));
        }//  www  .  ja va 2s . c  om
        updatedCoder.addComponentCoderIds(newComponentCoderId);
        rvalBuilder.getComponentsBuilder().putCoders(newComponentCoderId, componentCoder.getCoder());
        // Insert all component coders of the component coder.
        rvalBuilder.getComponentsBuilder().putAllCoders(componentCoder.getComponents().getCodersMap());
    }
    rvalBuilder.setCoder(updatedCoder);

    return rvalBuilder.build();
}

From source file:com.continuuity.loom.layout.change.AddServicesChange.java

@Override
public Set<Node> applyChange(Cluster cluster, Set<Node> clusterNodes, Map<String, Service> serviceMap) {
    Set<Node> changedNodes = Sets.newHashSet();
    Multiset<NodeLayout> countsToAdd = HashMultiset.create(countsPerNodeLayout);
    for (Node node : clusterNodes) {
        NodeLayout nodeLayout = NodeLayout.fromNode(node);
        if (countsToAdd.contains(nodeLayout)) {
            for (String service : services) {
                node.addService(serviceMap.get(service));
            }//from ww  w.  ja  v a2s  .c  om
            countsToAdd.setCount(nodeLayout, countsToAdd.count(nodeLayout) - 1);
            changedNodes.add(node);
        }
    }
    cluster.setServices(Sets.union(cluster.getServices(), services));
    return changedNodes;
}

From source file:com.github.explainable.sql.ast.select.SqlFromJoin.java

@Override
public Set<BaseTable> dependentTables() {
    Set<BaseTable> result;/*from   w  ww  . jav  a  2 s .c  o m*/
    switch (kind) {
    case INNER:
        result = Sets.union(left.dependentTables(), right.dependentTables());
        break;
    case LEFT_OUTER:
        result = right.dependentTables();
        break;
    case RIGHT_OUTER:
        result = left.dependentTables();
        break;
    case FULL_OUTER:
        result = ImmutableSet.of();
        break;
    default:
        throw new AssertionError("Unknown join kind: " + kind);
    }

    return result;
}