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(K k1, V v1) 

Source Link

Usage

From source file:org.auraframework.impl.java.controller.DelayedController.java

@AuraEnabled
public Object getComponents(@Key("token") String token) throws Exception {
    Component cmp = instanceService.getInstance("auratest:text", ComponentDef.class);
    Map<String, Object> atts = ImmutableMap.of("value", token);
    cmp.getAttributes().set(atts);//  w  w w  .  j  a v  a  2 s .  c o m
    try {
        Thread.sleep(2000);
    } catch (Exception ignored) {
    }
    return new Component[] { cmp };
}

From source file:com.palantir.atlasdb.table.description.Schemas.java

public static void createTable(KeyValueService kvs, String fullTableName, TableDefinition definition) {
    createTables(kvs, ImmutableMap.of(fullTableName, definition));
}

From source file:com.metamx.emitter.service.UnitEvent.java

@Override
@JsonValue/*  ww w  .  ja v  a  2 s  .  c o m*/
public Map<String, Object> toMap() {
    return ImmutableMap.<String, Object>of("feed", feed, "metrics", ImmutableMap.of("value", value));
}

From source file:org.apache.twill.yarn.DistributedShell.java

public DistributedShell(String... commands) {
    super(ImmutableMap.of("cmds", Joiner.on(';').join(commands)));
}

From source file:org.sonar.server.app.WebServer.java

WebServer(Props props) {
    new MinimumViableSystem().checkWritableTempDir()
            .checkRequiredJavaOptions(ImmutableMap.of("file.encoding", "UTF-8"));
    this.sharedDir = getSharedDir(props);
    this.tomcat = new EmbeddedTomcat(props);
}

From source file:ninja.leaping.permissionsex.backend.memory.MemoryOptionSubjectData.java

protected static <K, V> Map<K, V> updateImmutable(Map<K, V> input, K newKey, V newVal) {
    if (input == null) {
        return ImmutableMap.of(newKey, newVal);
    }/* w w w . ja  va 2  s  .  co  m*/
    Map<K, V> ret = new HashMap<>(input);
    ret.put(newKey, newVal);
    return Collections.unmodifiableMap(ret);
}

From source file:cokolwiek.rest.representations.MojaKlasaResultsRepresentation.java

public MojaKlasaResultsRepresentation(SearchResults results, URI self, I18nResolver i18nResolver) {
    this.matches = ImmutableList.copyOf(transform(results.getMatches(), MojaKlasaMatchRepresentation.apply()));
    this.errors = ImmutableList
            .copyOf(transform(results.getErrors(), MojaKlasaErrorRepresentation.apply(i18nResolver)));
    this.links = ImmutableMap.of("self", self);
    this.searchTime = checkNotNull(results, "results").getSearchTime();
}

From source file:shaded.org.openqa.selenium.remote.server.handler.FindChildElement.java

@Override
public Map<String, String> call() throws Exception {
    WebElement element = getElement().findElement(by);
    String elementId = getKnownElements().add(element);

    return ImmutableMap.of("ELEMENT", elementId);
}

From source file:org.jclouds.rackspace.cloudservers.options.RebuildServerOptions.java

@Override
public void bindToRequest(HttpRequest request, Map<String, String> postParams) {
    Map<String, Integer> image = Maps.newHashMap();
    if (imageId != null)
        image.put("imageId", imageId);
    super.bindToRequest(request, ImmutableMap.of("rebuild", image));
}

From source file:net.oneandone.troilus.referentialintegrity.Immutables.java

public static <K, V> Optional<ImmutableMap<K, V>> merge(Optional<ImmutableMap<K, V>> map, K key, V value) {
    if (map.isPresent()) {
        return Optional.of(merge(map.get(), key, value));
    } else {//from   w ww.  j av  a2s .  co m
        return Optional.of(ImmutableMap.of(key, value));
    }
}