Example usage for com.google.common.collect ImmutableMultimap copyOf

List of usage examples for com.google.common.collect ImmutableMultimap copyOf

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableMultimap copyOf.

Prototype

@Beta
public static <K, V> ImmutableMultimap<K, V> copyOf(
        Iterable<? extends Entry<? extends K, ? extends V>> entries) 

Source Link

Document

Returns an immutable multimap containing the specified entries.

Usage

From source file:com.google.devtools.build.lib.query2.output.ConservativeAspectResolver.java

@Override
public ImmutableMultimap<Attribute, Label> computeAspectDependencies(Target target,
        DependencyFilter dependencyFilter) throws InterruptedException {
    if (!(target instanceof Rule)) {
        return ImmutableMultimap.of();
    }//  w w  w .j  a  v a2  s . c  o m
    Rule rule = (Rule) target;

    Multimap<Attribute, Label> result = LinkedHashMultimap.create();
    for (Attribute attribute : rule.getAttributes()) {
        for (Aspect aspect : attribute.getAspects(rule)) {
            AspectDefinition.addAllAttributesOfAspect(rule, result, aspect, dependencyFilter);
        }
    }

    return ImmutableMultimap.copyOf(result);
}

From source file:org.onos.yangtools.yang.model.repo.api.SchemaResolutionException.java

public SchemaResolutionException(@Nonnull final String message, final Throwable cause,
        @Nonnull final Collection<SourceIdentifier> resolvedSources,
        @Nonnull final Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports) {
    super(formatMessage(message, resolvedSources, unsatisfiedImports), cause);
    this.unsatisfiedImports = ImmutableMultimap.copyOf(unsatisfiedImports);
    this.resolvedSources = ImmutableList.copyOf(resolvedSources);
}

From source file:io.helixservice.feature.restservice.controller.Request.java

/**
 * HTTP Headers from the request//from ww w.j  a  v a2  s.c  o  m
 *
 * @return Multimap of Headers to values
 */
public Multimap<String, String> getHeaders() {
    return ImmutableMultimap.copyOf(headers);
}

From source file:com.google.enterprise.connector.ldap.LdapSchemaFinder.java

public SchemaResult find(int maxResults) {
    Multimap<String, String> tempSchema = ArrayListMultimap.create();
    Set<SchemaResultError> errors = Sets.newHashSet();
    int resultCount = 0;
    for (Entry<String, Multimap<String, String>> entry : supplier.get().entrySet()) {
        String key = entry.getKey();
        Multimap<String, String> person = entry.getValue();
        tempSchema.putAll(person);//from  ww  w  . j  a  v  a2s  . co m
        resultCount++;
        if (resultCount >= maxResults) {
            break;
        }
    }
    ImmutableMultimap<String, String> schema = ImmutableMultimap.copyOf(tempSchema);
    SchemaResult schemaResult = new SchemaResult(schema, resultCount, errors);
    return schemaResult;
}

From source file:org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.java

@Inject
public PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet(
        LoadingCache<String, Set<? extends Extension>> extensions, Multimap<URI, URI> aliases) {
    this.extensions = checkNotNull(extensions, "extensions");
    this.aliases = aliases == null ? ImmutableMultimap.<URI, URI>of() : ImmutableMultimap.copyOf(aliases);
}

From source file:com.github.lstephen.ootp.ai.selection.SlotAssignments.java

public ImmutableMultimap<Slot, Player> toMap() {
    return ImmutableMultimap.copyOf(assignments);
}

From source file:org.javersion.core.MergeBuilder.java

public Multimap<K, VersionProperty<V>> getConflicts() {
    ensureInitialized();
    locked = true;
    return ImmutableMultimap.copyOf(conflicts);
}

From source file:org.killbill.billing.client.RequestOptions.java

public RequestOptions(final String requestId, final String user, final String password, final String createdBy,
        final String reason, final String comment, final String tenantApiKey, final String tenantApiSecret,
        final Map<String, String> headers, final Multimap<String, String> queryParams,
        final Boolean followLocation, final Multimap<String, String> queryParamsForFollow) {
    this.requestId = requestId;
    this.user = user;
    this.password = password;
    this.createdBy = createdBy;
    this.reason = reason;
    this.comment = comment;
    this.tenantApiKey = tenantApiKey;
    this.tenantApiSecret = tenantApiSecret;
    this.headers = (headers != null) ? ImmutableMap.copyOf(headers) : ImmutableMap.<String, String>of();
    this.queryParams = (queryParams != null) ? ImmutableMultimap.copyOf(queryParams)
            : ImmutableMultimap.<String, String>of();
    this.followLocation = followLocation;
    this.queryParamsForFollow = ImmutableMultimap.copyOf(queryParamsForFollow);
}

From source file:org.trancecode.xproc.XProcTestCase.java

public XProcTestCase(final URL url, final String testSuite, final String title, final XdmNode description,
        final boolean ignoreWhitespace, final XdmNode pipeline, final Multimap<String, List<XdmNode>> inputs,
        final Map<QName, String> options, final Map<String, Map<QName, String>> parameters, final QName error,
        final Map<String, List<XdmNode>> outputs, final XdmNode comparePipeline) {
    this.url = Preconditions.checkNotNull(url);
    this.testSuite = testSuite;
    this.title = title;
    this.description = description;
    this.ignoreWhitespace = ignoreWhitespace;
    this.pipeline = pipeline;
    this.inputs = ImmutableMultimap.copyOf(inputs);
    this.options = ImmutableMap.copyOf(options);
    this.parameters = ImmutableMap.copyOf(parameters);
    this.error = error;
    this.outputs = ImmutableMap.copyOf(outputs);
    this.comparePipeline = comparePipeline;
}

From source file:org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException.java

public SchemaResolutionException(@Nonnull final String message, final SourceIdentifier failedSource,
        final Throwable cause, @Nonnull final Collection<SourceIdentifier> resolvedSources,
        @Nonnull final Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports) {
    super(formatMessage(message, failedSource, resolvedSources, unsatisfiedImports), cause);
    this.failedSource = failedSource;
    this.unsatisfiedImports = ImmutableMultimap.copyOf(unsatisfiedImports);
    this.resolvedSources = ImmutableList.copyOf(resolvedSources);
}