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:net.minecraftforge.common.model.animation.AnimationStateMachine.java

@Deprecated
public AnimationStateMachine(ImmutableMap<String, ITimeValue> parameters, ImmutableMap<String, IClip> clips,
        ImmutableList<String> states, ImmutableMap<String, String> transitions, String startState) {
    this(parameters, clips, states, ImmutableMultimap.copyOf(Multimaps
            .newSetMultimap(Maps.transformValues(transitions, new Function<String, Collection<String>>() {
                public Collection<String> apply(String input) {
                    return ImmutableSet.of(input);
                }/*from   w  w  w . j a  v  a  2 s .co  m*/
            }), new Supplier<Set<String>>() {
                public Set<String> get() {
                    return Sets.newHashSet();
                }
            })), startState);
}

From source file:com.moz.fiji.schema.impl.hbase.HBaseFijiTableReaderBuilder.java

/** {@inheritDoc} */
@Override/*  w w  w . j  a va2 s  .c  om*/
public FijiTableReaderBuilder withColumnReaderSpecAlternatives(
        final Multimap<FijiColumnName, ColumnReaderSpec> alternatives) {
    Preconditions.checkNotNull(alternatives, "ColumnReaderSpec alternatives may not be null.");
    Preconditions.checkState(null == mAlternatives, "ColumnReaderSpec alternatives already set to: %s",
            mAlternatives);
    mAlternatives = ImmutableMultimap.copyOf(alternatives);
    return this;
}

From source file:org.spongepowered.common.registry.SpongeVillagerRegistry.java

@Override
public Multimap<Integer, TradeOfferListMutator> getTradeOfferLevelMap(Career career) {
    final Multimap<Integer, TradeOfferListMutator> multimap = this.careerGeneratorMap
            .get(checkNotNull(career, "Career cannot be null!"));
    if (multimap == null) {
        return ImmutableMultimap.of();
    } else {//from www  .ja  v a2 s.c om
        return ImmutableMultimap.copyOf(multimap);
    }
}

From source file:org.jclouds.ec2.domain.IpPermissionImpl.java

public IpPermissionImpl(IpProtocol ipProtocol, int fromPort, int toPort,
        Multimap<String, String> userIdGroupPairs, Iterable<String> groupIds, Iterable<String> ipRanges) {
    this.fromPort = fromPort;
    this.toPort = toPort;
    this.userIdGroupPairs = ImmutableMultimap.copyOf(checkNotNull(userIdGroupPairs, "userIdGroupPairs"));
    this.ipProtocol = checkNotNull(ipProtocol, "ipProtocol");
    this.groupIds = ImmutableSet.copyOf(checkNotNull(groupIds, "groupIds"));
    this.ipRanges = ImmutableSet.copyOf(checkNotNull(ipRanges, "ipRanges"));
}

From source file:com.hippo.leveldb.impl.VersionEdit.java

public Multimap<Integer, BucketMetaData> getNewBFiles() {
    return ImmutableMultimap.copyOf(newBFiles);
}

From source file:net.conquiris.lucene.search.Hit.java

/**
 * Constructor./*from  w  ww  .  jav  a  2s .co m*/
 */
private Hit(int docId, float score, Document document, @Nullable Multimap<String, String> fragments) {
    this.docId = docId;
    this.score = score;
    this.document = checkNotNull(document, "The document must be provided");
    if (fragments == null) {
        this.fragments = ImmutableMultimap.of();
    } else {
        this.fragments = ImmutableMultimap.copyOf(fragments);
    }
    ImmutableListMultimap.Builder<String, Fieldable> fieldsBuilder = ImmutableListMultimap.builder();
    ImmutableListMultimap.Builder<String, Number> numericBuilder = ImmutableListMultimap.builder();
    ImmutableListMultimap.Builder<String, Fieldable> binaryBuilder = ImmutableListMultimap.builder();
    for (Fieldable f : document.getFields()) {
        final String name = f.name();
        if (f.isBinary()) {
            binaryBuilder.put(name, f);
        } else {
            fieldsBuilder.put(name, f);
            if (f instanceof NumericField) {
                numericBuilder.put(name, ((NumericField) f).getNumericValue());
            }
        }
    }
    this.fields = fieldsBuilder.build();
    this.numeric = numericBuilder.build();
    this.binary = binaryBuilder.build();
}

From source file:grakn.core.graql.executor.WriteExecutor.java

private WriteExecutor(TransactionOLTP transaction, Set<Writer> writers, Partition<Variable> equivalentVars,
        Multimap<Writer, Writer> executorDependency) {
    this.transaction = transaction;
    this.writers = ImmutableSet.copyOf(writers);
    this.equivalentVars = equivalentVars;
    this.dependencies = ImmutableMultimap.copyOf(executorDependency);
}

From source file:com.facebook.buck.apple.xcode.WorkspaceAndProjectGenerator.java

public WorkspaceAndProjectGenerator(ProjectFilesystem projectFilesystem, TargetGraph projectGraph,
        ExecutionContext executionContext, BuildRuleResolver buildRuleResolver,
        SourcePathResolver sourcePathResolver,
        TargetNode<XcodeWorkspaceConfigDescription.Arg> workspaceTargetNode,
        Set<ProjectGenerator.Option> projectGeneratorOptions,
        Multimap<BuildTarget, TargetNode<?>> sourceTargetToTestNodes, boolean combinedProject) {
    this.projectFilesystem = projectFilesystem;
    this.projectGraph = projectGraph;
    this.executionContext = executionContext;
    this.buildRuleResolver = buildRuleResolver;
    this.sourcePathResolver = sourcePathResolver;
    this.workspaceTargetNode = workspaceTargetNode;
    this.projectGeneratorOptions = ImmutableSet.copyOf(projectGeneratorOptions);
    this.sourceTargetToTestNodes = ImmutableMultimap.copyOf(sourceTargetToTestNodes);
    this.combinedProject = combinedProject;
    this.combinedProjectGenerator = Optional.absent();
    extraTestBundleTargetNodes = ImmutableSet
            .copyOf(projectGraph.getAll(workspaceTargetNode.getConstructorArg().extraTests.get()));
}

From source file:org.jclouds.ec2.domain.IpPermission.java

public IpPermission(IpProtocol ipProtocol, int fromPort, int toPort, Multimap<String, String> userIdGroupPairs,
        Iterable<String> groupIds, Iterable<String> ipRanges) {
    this.fromPort = fromPort;
    this.toPort = toPort;
    this.userIdGroupPairs = ImmutableMultimap.copyOf(checkNotNull(userIdGroupPairs, "userIdGroupPairs"));
    this.ipProtocol = checkNotNull(ipProtocol, "ipProtocol");
    this.groupIds = ImmutableSet.copyOf(checkNotNull(groupIds, "groupIds"));
    this.ipRanges = ImmutableSet.copyOf(checkNotNull(ipRanges, "ipRanges"));
}

From source file:com.github.explainable.benchmark.preparedstmt.PrepStmtBenchmark2.java

private PrepStmtBenchmark2(List<View> securityViews, Multimap<String, View> preparedViews,
        SqlExecGenerator execGenerator, CountDownLatch signal, int iterations, BenchmarkStage lastStage) {
    Preconditions.checkArgument(iterations > 0);

    this.securityViews = ImmutableList.copyOf(securityViews);
    this.preparedViews = ImmutableMultimap.copyOf(preparedViews);
    this.execGenerator = Preconditions.checkNotNull(execGenerator);
    this.signal = Preconditions.checkNotNull(signal);
    this.iterations = iterations;
    this.lastStage = Preconditions.checkNotNull(lastStage);
}