Example usage for com.google.common.collect ImmutableMap.Builder put

List of usage examples for com.google.common.collect ImmutableMap.Builder put

Introduction

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

Prototype

public final V put(K k, V v) 

Source Link

Usage

From source file:com.addthis.hydra.job.spawn.SpawnUtils.java

public static Map<String, JobMacro> getMacroMapFromMacroManager(JobEntityManager<JobMacro> jobMacroManager) {
    ImmutableMap.Builder<String, JobMacro> builder = ImmutableMap.builder();

    for (String macroName : jobMacroManager.getKeys()) {
        builder.put(macroName, jobMacroManager.getEntity(macroName));
    }/*from   www  .  ja  va  2s .c  o  m*/

    return builder.build();
}

From source file:google.registry.rdap.RdapTestHelper.java

static void addDomainBoilerplateRemarks(ImmutableMap.Builder<String, Object> builder) {
    builder.put("remarks", ImmutableList.of(ImmutableMap.of("description",
            ImmutableList.of("This response conforms to the RDAP Operational Profile for gTLD Registries and"
                    + " Registrars version 1.0")),
            ImmutableMap.of("title", "EPP Status Codes", "description", ImmutableList
                    .of("For more information on domain status codes, please visit" + " https://icann.org/epp"),
                    "links",
                    ImmutableList.of(ImmutableMap.of("value", "https://icann.org/epp", "rel", "alternate",
                            "href", "https://icann.org/epp", "type", "text/html"))),
            ImmutableMap.of("description",
                    ImmutableList/*from  w  ww  .j ava2 s . c  o  m*/
                            .of("URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf"),
                    "links", ImmutableList.of(ImmutableMap.of("value", "https://www.icann.org/wicf", "rel",
                            "alternate", "href", "https://www.icann.org/wicf", "type", "text/html")))));
}

From source file:com.google.template.soy.jbcsrc.internal.MemoryClassLoader.java

private static ImmutableMap<String, ClassData> indexByClassname(Iterable<ClassData> classes) {
    ImmutableMap.Builder<String, ClassData> builder = ImmutableMap.builder();
    for (ClassData classData : classes) {
        builder.put(classData.type().className(), classData);
    }//from   www .  ja v  a2 s. co m
    return builder.build();
}

From source file:com.helion3.bedrock.commands.WorldCommand.java

public static CommandSpec getCommand() {
    ImmutableMap.Builder<List<String>, CommandCallable> builder = ImmutableMap
            .<List<String>, CommandCallable>builder();
    builder.put(ImmutableList.of("difficulty"), DifficultyCommand.getCommand());

    return CommandSpec.builder().executor((src, args) -> {
        return CommandResult.empty();
    }).children(builder.build()).build();
}

From source file:org.janusgraph.diskstorage.es.ElasticSearchMutation.java

public static ElasticSearchMutation createUpdateRequest(String index, String type, String id,
        ImmutableMap.Builder builder, Map upsert) {
    final Map source = upsert == null ? builder.build() : builder.put(ES_UPSERT_KEY, upsert).build();
    return new ElasticSearchMutation(RequestType.UPDATE, index, type, id, source);
}

From source file:com.facebook.buck.util.MoreMaps.java

public static <K1, K2, V> ImmutableMap<K2, V> transformKeys(Map<K1, V> map,
        Function<? super K1, K2> transformer) {
    ImmutableMap.Builder<K2, V> transformedMap = ImmutableMap.builder();
    for (Map.Entry<K1, V> ent : map.entrySet()) {
        transformedMap.put(Preconditions.checkNotNull(transformer.apply(ent.getKey())), ent.getValue());
    }/*from w ww.j a  v a 2s  .c om*/
    return transformedMap.build();
}

From source file:com.google.idea.blaze.base.lang.buildfile.lexer.BuildToken.java

private static ImmutableMap<TokenKind, BuildToken> createMap() {
    ImmutableMap.Builder<TokenKind, BuildToken> builder = ImmutableMap.builder();
    for (TokenKind kind : TokenKind.values()) {
        builder.put(kind, new BuildToken(kind));
    }//from  w  ww.  j av  a2s . c o m
    return builder.build();
}

From source file:com.helion3.bedrock.commands.BedrockCommands.java

public static CommandSpec getCommand() {
    ImmutableMap.Builder<List<String>, CommandCallable> builder = ImmutableMap
            .<List<String>, CommandCallable>builder();
    builder.put(ImmutableList.of("reload"), ReloadCommand.getCommand());

    return CommandSpec.builder().executor((src, args) -> {
        src.sendMessage(Text.of(Format.heading(TextColors.GRAY, "By ", TextColors.GOLD, "viveleroi.\n"),
                TextColors.GRAY, "IRC: ", TextColors.WHITE, "irc.esper.net #prism"));
        return CommandResult.empty();
    }).children(builder.build()).build();
}

From source file:org.semanticweb.elk.reasoner.config.EvictorBuilder.java

private static void put(final ImmutableMap.Builder<String, Class<?>> builder, final Class<?> value) {
    builder.put(value.getSimpleName(), value);
}

From source file:com.facebook.buck.android.exopackage.ExopackageUtil.java

public static ImmutableMap<Path, Path> applyFilenameFormat(Map<String, Path> filesToHashes, Path deviceDir,
        String filenameFormat) {// w  ww  .  jav  a2s  . c  o  m
    ImmutableMap.Builder<Path, Path> filesBuilder = ImmutableMap.builder();
    for (Map.Entry<String, Path> entry : filesToHashes.entrySet()) {
        filesBuilder.put(deviceDir.resolve(String.format(filenameFormat, entry.getKey())), entry.getValue());
    }
    return filesBuilder.build();
}