Example usage for com.google.common.collect ImmutableMultimap.Builder putAll

List of usage examples for com.google.common.collect ImmutableMultimap.Builder putAll

Introduction

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

Prototype

@Deprecated
@Override
public boolean putAll(Multimap<? extends K, ? extends V> multimap) 

Source Link

Document

Guaranteed to throw an exception and leave the multimap unmodified.

Usage

From source file:com.wrmsr.search.dsl.util.ImmutableCollectors.java

public static <I, K, V> Collector<I, ImmutableMultimap.Builder<K, V>, ImmutableMultimap<K, V>> toImmutableMultimap(
        Function<I, K> keyMapper, Function<I, V> valueMapper) {
    return Collector.of(ImmutableMultimap::builder,
            (builder, in) -> builder.put(keyMapper.apply(in), valueMapper.apply(in)),
            (ImmutableMultimap.Builder<K, V> left, ImmutableMultimap.Builder<K, V> right) -> left
                    .putAll(right.build()),
            ImmutableMultimap.Builder<K, V>::build);
}

From source file:com.palantir.atlasdb.cleaner.CleanupFollower.java

public static CleanupFollower create(Iterable<Schema> schemas) {
    ImmutableMultimap.Builder<String, OnCleanupTask> cleanupTasksByTable = ImmutableMultimap.builder();
    for (Schema schema : schemas) {
        cleanupTasksByTable.putAll(schema.getCleanupTasksByTable());
    }/*ww w  .  j  av a  2s. c  o m*/
    return new CleanupFollower(cleanupTasksByTable.build());
}

From source file:com.wrmsr.kleist.util.collect.MoreCollectors.java

public static <I, K, V> Collector<I, ImmutableMultimap.Builder<K, V>, ImmutableMultimap<K, V>> toImmutableMultimap(
        Function<I, K> keyMapper, Function<I, V> valueMapper) {
    return Collector.of(ImmutableMultimap::builder,
            (builder, in) -> builder.put(keyMapper.apply(in), valueMapper.apply(in)),
            (ImmutableMultimap.Builder<K, V> left, ImmutableMultimap.Builder<K, V> right) -> left
                    .putAll(right.build()),
            ImmutableMultimap.Builder::build);
}

From source file:com.facebook.buck.cxx.AbstractCxxPreprocessorInput.java

public static CxxPreprocessorInput concat(Iterable<CxxPreprocessorInput> inputs) {
    ImmutableMultimap.Builder<CxxSource.Type, String> preprocessorFlags = ImmutableMultimap.builder();
    ImmutableList.Builder<CxxHeaders> headers = ImmutableList.builder();
    ImmutableSet.Builder<FrameworkPath> frameworks = ImmutableSet.builder();
    ImmutableSet.Builder<BuildTarget> rules = ImmutableSet.builder();

    for (CxxPreprocessorInput input : inputs) {
        preprocessorFlags.putAll(input.getPreprocessorFlags());
        headers.addAll(input.getIncludes());
        frameworks.addAll(input.getFrameworks());
        rules.addAll(input.getRules());/*from w  w  w  .  j  av a2 s  .c  o m*/
    }

    return CxxPreprocessorInput.of(preprocessorFlags.build(), headers.build(), frameworks.build(),
            rules.build());
}

From source file:com.facebook.buck.cxx.CxxPreprocessorInput.java

public static CxxPreprocessorInput concat(Iterable<CxxPreprocessorInput> inputs) {
    ImmutableSet.Builder<BuildTarget> rules = ImmutableSet.builder();
    ImmutableMultimap.Builder<CxxSource.Type, String> preprocessorFlags = ImmutableMultimap.builder();
    ImmutableCxxHeaders.Builder includes = ImmutableCxxHeaders.builder();
    ImmutableList.Builder<Path> includeRoots = ImmutableList.builder();
    ImmutableList.Builder<Path> systemIncludeRoots = ImmutableList.builder();

    for (CxxPreprocessorInput input : inputs) {
        rules.addAll(input.getRules());//from  w  ww . j a  v a  2 s . c om
        preprocessorFlags.putAll(input.getPreprocessorFlags());
        includes.putAllNameToPathMap(input.getIncludes().nameToPathMap());
        includes.putAllFullNameToPathMap(input.getIncludes().fullNameToPathMap());
        includeRoots.addAll(input.getIncludeRoots());
        systemIncludeRoots.addAll(input.getSystemIncludeRoots());
    }

    return new CxxPreprocessorInput(rules.build(), preprocessorFlags.build(), includes.build(),
            includeRoots.build(), systemIncludeRoots.build());
}

From source file:com.google.devtools.build.lib.worker.WorkerActionContextProvider.java

public WorkerActionContextProvider(CommandEnvironment env, BuildRequest buildRequest, WorkerPool workers) {
    int maxRetries = buildRequest.getOptions(WorkerOptions.class).workerMaxRetries;
    ImmutableMultimap.Builder<String, String> extraFlags = ImmutableMultimap.builder();
    extraFlags.putAll(buildRequest.getOptions(WorkerOptions.class).workerExtraFlags);

    WorkerSpawnStrategy workerSpawnStrategy = new WorkerSpawnStrategy(env.getDirectories(), workers,
            buildRequest.getOptions(ExecutionOptions.class).verboseFailures, maxRetries,
            buildRequest.getOptions(WorkerOptions.class).workerVerbose, extraFlags.build());
    TestActionContext workerTestStrategy = new WorkerTestStrategy(env, buildRequest, workers, maxRetries,
            extraFlags.build());/*from   w  w w. j a v a  2 s  .  c  o  m*/
    this.strategies = ImmutableList.of(workerSpawnStrategy, workerTestStrategy);
}

From source file:com.isotrol.impe3.api.PageURI.java

public PageURI add(PageURI uri) {
    if (uri == null) {
        return this;
    }/*from w  w w  .j a  v  a2 s . c o m*/
    final PathSegments _path = path.add(uri.path);
    final ImmutableMultimap.Builder<String, String> b = ImmutableMultimap.builder();
    b.putAll(parameters).putAll(uri.parameters);
    return new PageURI(_path, b.build());
}

From source file:com.spectralogic.ds3client.commands.interfaces.RequestHeadersImpl.java

/**
 * Retrieves the percent-encoded multimap. Used in {@link NetworkClientImpl}
 *///from   ww  w . j  a  va 2  s .c o  m
@Override
public Multimap<String, String> getMultimap() {
    final ImmutableMultimap.Builder<String, String> builder = ImmutableMultimap.builder();
    builder.putAll(headers);
    return builder.build();
}

From source file:com.facebook.buck.android.AndroidAppModularity.java

@Override
public ImmutableList<Step> getBuildSteps(BuildContext buildContext, BuildableContext buildableContext) {
    ImmutableList.Builder<Step> steps = ImmutableList.builder();

    Path metadataFile = buildContext.getSourcePathResolver().getRelativePath(getSourcePathToOutput());

    steps.add(MkdirStep.of(BuildCellRelativePath.fromCellRelativePath(buildContext.getBuildCellRootPath(),
            getProjectFilesystem(), metadataFile.getParent())));

    ImmutableMultimap.Builder<APKModule, Path> additionalDexStoreToJarPathMapBuilder = ImmutableMultimap
            .builder();//from   w w  w  .  ja v a  2  s .  c o m
    additionalDexStoreToJarPathMapBuilder
            .putAll(result.getPackageableCollection().getModuleMappedClasspathEntriesToDex().entries().stream()
                    .map(input -> new AbstractMap.SimpleEntry<>(input.getKey(),
                            getProjectFilesystem().relativize(
                                    buildContext.getSourcePathResolver().getAbsolutePath(input.getValue()))))
                    .collect(ImmutableSet.toImmutableSet()));
    ImmutableMultimap<APKModule, Path> additionalDexStoreToJarPathMap = additionalDexStoreToJarPathMapBuilder
            .build();

    steps.add(WriteAppModuleMetadataStep.writeModuleMetadata(metadataFile, additionalDexStoreToJarPathMap,
            result.getAPKModuleGraph(), getProjectFilesystem(), Optional.empty(), Optional.empty(),
            /*skipProguard*/ true));

    buildableContext.recordArtifact(metadataFile);

    return steps.build();
}

From source file:org.apache.calcite.rel.metadata.ChainedRelMetadataProvider.java

public <M extends Metadata> Multimap<Method, MetadataHandler<M>> handlers(MetadataDef<M> def) {
    final ImmutableMultimap.Builder<Method, MetadataHandler<M>> builder = ImmutableMultimap.builder();
    for (RelMetadataProvider provider : providers.reverse()) {
        builder.putAll(provider.handlers(def));
    }//from  w  ww  .j  ava 2  s  .c  o m
    return builder.build();
}