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

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

Introduction

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

Prototype

@Beta
public static <K, V> ImmutableListMultimap<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:org.dishevelled.bio.variant.vcf.header.VcfSampleHeaderLine.java

/**
 * Create a new VCF SAMPLE header line.//from   ww  w.j  a  va2s.  c om
 *
 * @param id header line ID, must not be null
 * @param attributes header line attributes, must not be null
 */
VcfSampleHeaderLine(final String id, final ListMultimap<String, String> attributes) {
    checkNotNull(id);
    checkNotNull(attributes);

    this.id = id;
    this.attributes = ImmutableListMultimap.copyOf(attributes);
}

From source file:com.isotrol.impe3.web20.server.CounterMap.java

CounterMap(Builder builder) {
    for (Key k : builder.builder.keySet()) {
        Collections.sort(builder.builder.get(k), ORDER);
    }// w ww  .j  a  v  a 2 s  .  c  om
    this.map = ImmutableListMultimap.copyOf(builder.builder);
    this.resourceMap = builder.resources.build();
}

From source file:org.dishevelled.bio.variant.vcf.header.VcfAltHeaderLine.java

/**
 * Create a new VCF ALT header line./*from   w  ww .  j a  v  a  2  s .c  om*/
 *
 * @param id header line ID, must not be null
 * @param description header line description, must not be null
 * @param attributes header line attributes, must not be null
 */
VcfAltHeaderLine(final String id, final String description, final ListMultimap<String, String> attributes) {
    checkNotNull(id);
    checkNotNull(description);
    checkNotNull(attributes);

    this.id = id;
    this.description = description;
    this.attributes = ImmutableListMultimap.copyOf(attributes);
}

From source file:org.dishevelled.bio.variant.vcf.header.VcfFilterHeaderLine.java

/**
 * Create a new VCF FILTER header line.//from   w w  w  .j  a  v a 2  s .  c om
 *
 * @param id header line id, must not be null
 * @param description header line description, must not be null
 * @param attributes header line attributes, must not be null
 */
VcfFilterHeaderLine(final String id, final String description, final ListMultimap<String, String> attributes) {
    checkNotNull(id);
    checkNotNull(description);
    checkNotNull(attributes);

    this.id = id;
    this.description = description;
    this.attributes = ImmutableListMultimap.copyOf(attributes);
}

From source file:com.github.rinde.logistics.pdptw.mas.route.RoutePlannerStatsLogger.java

/**
 * @return A multimap of {@link RoutePlanner}s to
 *         {@link SolverTimeMeasurement}s.
 */// w ww .  j a v  a 2 s  . c  o m
public ImmutableListMultimap<RoutePlanner, SolverTimeMeasurement> getTimeMeasurements() {
    final ListMultimap<RoutePlanner, SolverTimeMeasurement> map = ArrayListMultimap.create();
    for (final RoutePlanner rp : routePlanners) {
        map.putAll(rp, ((Measurable) rp).getTimeMeasurements());
    }
    return ImmutableListMultimap.copyOf(map);
}

From source file:com.facebook.presto.sql.planner.plan.UnionNode.java

@JsonCreator
public UnionNode(@JsonProperty("id") PlanNodeId id, @JsonProperty("sources") List<PlanNode> sources,
        @JsonProperty("symbolMapping") ListMultimap<Symbol, Symbol> symbolMapping) {
    super(id);/*  w  w w .  j ava 2  s .  c  o m*/

    requireNonNull(sources, "sources is null");
    checkArgument(!sources.isEmpty(), "Must have at least one source");
    requireNonNull(symbolMapping, "symbolMapping is null");

    this.sources = ImmutableList.copyOf(sources);
    this.symbolMapping = ImmutableListMultimap.copyOf(symbolMapping);

    for (Collection<Symbol> symbols : this.symbolMapping.asMap().values()) {
        checkArgument(symbols.size() == this.sources.size(),
                "Every source needs to map its symbols to an output UNION symbol");
    }

    // Make sure each source positionally corresponds to their Symbol values in the Multimap
    for (int i = 0; i < sources.size(); i++) {
        for (Collection<Symbol> symbols : this.symbolMapping.asMap().values()) {
            checkArgument(sources.get(i).getOutputSymbols().contains(Iterables.get(symbols, i)),
                    "Source does not provide required symbols");
        }
    }
}

From source file:com.kurtraschke.ctatt.gtfsrealtime.services.GtfsDaoService.java

public Multimap<String, Trip> getScheduledTripMapping() {
    return ImmutableListMultimap.copyOf(scheduledTripMapping);
}

From source file:io.prestosql.sql.planner.plan.SetOperationNode.java

@JsonCreator
protected SetOperationNode(@JsonProperty("id") PlanNodeId id, @JsonProperty("sources") List<PlanNode> sources,
        @JsonProperty("outputToInputs") ListMultimap<Symbol, Symbol> outputToInputs,
        @JsonProperty("outputs") List<Symbol> outputs) {
    super(id);/*from w  w  w .ja v  a 2 s . c  o  m*/

    requireNonNull(sources, "sources is null");
    checkArgument(!sources.isEmpty(), "Must have at least one source");
    requireNonNull(outputToInputs, "outputToInputs is null");
    requireNonNull(outputs, "outputs is null");

    this.sources = ImmutableList.copyOf(sources);
    this.outputToInputs = ImmutableListMultimap.copyOf(outputToInputs);
    this.outputs = ImmutableList.copyOf(outputs);

    for (Collection<Symbol> inputs : this.outputToInputs.asMap().values()) {
        checkArgument(inputs.size() == this.sources.size(),
                "Every source needs to map its symbols to an output %s operation symbol",
                this.getClass().getSimpleName());
    }

    // Make sure each source positionally corresponds to their Symbol values in the Multimap
    for (int i = 0; i < sources.size(); i++) {
        for (Collection<Symbol> expectedInputs : this.outputToInputs.asMap().values()) {
            checkArgument(sources.get(i).getOutputSymbols().contains(Iterables.get(expectedInputs, i)),
                    "Source does not provide required symbols");
        }
    }
}

From source file:com.isotrol.impe3.web20.server.RatingMap.java

RatingMap(Builder builder) {
    Collections.sort(builder.global, ORDER);
    for (Long k : builder.group.keySet()) {
        Collections.sort(builder.group.get(k), ORDER);
    }/*from  w w  w .  j a v  a 2  s  . c  o m*/
    this.global = ImmutableList.copyOf(builder.global);
    this.map = ImmutableListMultimap.copyOf(builder.group);
    this.resourceMap = builder.resources.build();
}

From source file:org.dishevelled.bio.variant.vcf.header.VcfStructuredHeaderLine.java

/**
 * Create a new structured VCF header line.
 *
 * @param name structured header line name, must not be null
 * @param id header line ID, must not be null
 * @param attributes header line attributes, must not be null
 *///from  w w  w  .j av  a 2 s .  c  o  m
VcfStructuredHeaderLine(final String name, final String id, final ListMultimap<String, String> attributes) {
    checkNotNull(name);
    checkNotNull(id);
    checkNotNull(attributes);

    this.name = name;
    this.id = id;
    this.attributes = ImmutableListMultimap.copyOf(attributes);
}