Example usage for com.google.common.collect ImmutableMap of

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

Introduction

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

Prototype

public static <K, V> ImmutableMap<K, V> of() 

Source Link

Usage

From source file:com.tozny.mobiledemo.SessionDAO.java

public SessionDAO() {
    sessionMap = ImmutableMap.of();
}

From source file:org.apache.james.jmap.model.SetFilterResponse.java

public static SetFilterResponse updated() {
    return new SetFilterResponse(ImmutableList.of(SINGLETON), ImmutableMap.of());
}

From source file:io.prestosql.plugin.blackhole.BlackHoleQueryRunner.java

public static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception {
    Session session = testSessionBuilder().setCatalog("blackhole").setSchema("default").build();

    DistributedQueryRunner queryRunner = new DistributedQueryRunner(session, 4, extraProperties);

    try {/*from w  ww  .j  av a  2  s.com*/
        queryRunner.installPlugin(new BlackHolePlugin());
        queryRunner.createCatalog("blackhole", "blackhole", ImmutableMap.of());

        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of());

        return queryRunner;
    } catch (Exception e) {
        closeAllSuppress(e, queryRunner);
        throw e;
    }
}

From source file:com.linecorp.armeria.server.PathMappingResult.java

/**
 * Creates a new instance with the specified {@code path} and {@code query}, without any path parameters.
 *//*from w w w  .j av  a  2  s. c  o m*/
public static PathMappingResult of(String path, @Nullable String query) {
    return of(path, query, ImmutableMap.of());
}

From source file:org.jmingo.parser.xml.dom.util.DomUtil.java

/**
 * Transform node attributes to map./*from w  w  w . j  a v  a 2  s . com*/
 *
 * @param node the node {@link Node}
 * @return map : key - attribute name; value - attribute value
 */
public static Map<String, String> getAttributes(Node node) {
    Map<String, String> attributes = ImmutableMap.of();
    if (node.hasAttributes()) {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
        // get attributes names and values
        NamedNodeMap nodeMap = node.getAttributes();
        for (int i = 0; i < nodeMap.getLength(); i++) {
            Node currentNode = nodeMap.item(i);
            builder.put(currentNode.getNodeName(), currentNode.getNodeValue());
        }
        attributes = builder.build();
    }
    return attributes;
}

From source file:com.google.devtools.build.lib.syntax.DebugFrame.java

public static Builder builder() {
    return new AutoValue_DebugFrame.Builder().setLexicalFrameBindings(ImmutableMap.of());
}

From source file:com.google.googlejavaformat.intellij.FormatterUtil.java

static Map<TextRange, String> getReplacements(Formatter formatter, String text, Collection<TextRange> ranges) {
    try {/*from   ww w. j a  va2  s .  c  o m*/
        ImmutableMap.Builder<TextRange, String> replacements = ImmutableMap.builder();
        formatter.getFormatReplacements(text, toRanges(ranges)).forEach(replacement -> replacements
                .put(toTextRange(replacement.getReplaceRange()), replacement.getReplacementString()));
        return replacements.build();
    } catch (FormatterException e) {
        return ImmutableMap.of();
    }
}

From source file:org.apache.cassandra.schema.ReplicationParams.java

static ReplicationParams local() {
    return new ReplicationParams(LocalStrategy.class, ImmutableMap.of());
}

From source file:co.cask.cdap.cli.util.ArgumentParser.java

/**
 * Parses a map in the format: "key1=a key2=b .."
 *
 * @param mapString {@link String} representation of the map
 * @return the map//from w  w  w .  ja  v a 2 s  . c  o  m
 */
public static Map<String, String> parseMap(String mapString) {
    if (mapString == null || mapString.isEmpty()) {
        return ImmutableMap.of();
    }

    ImmutableMap.Builder<String, String> result = ImmutableMap.builder();
    List<String> tokens = Parser.parseInput(mapString);
    for (String token : tokens) {
        int firstEquals = token.indexOf('=');
        if (firstEquals > 0) {
            String key = token.substring(0, firstEquals);
            String value = token.substring(firstEquals + 1, token.length());
            result.put(extractValue(key), extractValue(value));
        }
    }
    return result.build();
}

From source file:com.spotify.heroic.grammar.Value.java

static AggregationValue aggregation(String name, ListValue arguments) {
    return aggregation(name, arguments, ImmutableMap.of());
}