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

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

Introduction

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

Prototype

public static <K, V> ImmutableMap<K, V> copyOf(Iterable<? extends Entry<? extends K, ? extends V>> entries) 

Source Link

Usage

From source file:org.jooby.internal.js.JsResponse.java

public void sendjs(final ScriptObjectMirror result) throws Throwable {
    Object value;/*from ww  w .j  a v  a  2  s  .c o m*/
    if (result.isArray()) {
        value = result.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
    } else {
        value = ImmutableMap.copyOf(result);
    }
    super.send(value);
}

From source file:io.soabase.guice.ServletDefinition.java

ServletDefinition(List<String> patterns, Key<? extends HttpServlet> servletKey, Map<String, String> initParams,
        HttpServlet servletInstance) {/*from w  ww .  j a  va 2s  .c om*/
    this.patterns = ImmutableList.copyOf(patterns);
    this.servletKey = servletKey;
    this.initParams = ImmutableMap.copyOf(Maps.newHashMap(initParams));
    this.servletInstance = servletInstance;
}

From source file:com.google.devtools.build.lib.bazel.repository.skylark.SkylarkOS.java

SkylarkOS(Map<String, String> environ) {
    this.environ = ImmutableMap.copyOf(environ);
}

From source file:io.airlift.discovery.DynamicServiceAnnouncement.java

@JsonCreator
public DynamicServiceAnnouncement(@JsonProperty("id") Id<Service> id, @JsonProperty("type") String type,
        @JsonProperty("properties") Map<String, String> properties) {
    this.id = id;
    this.type = type;

    if (properties != null) {
        this.properties = ImmutableMap.copyOf(properties);
    } else {//from w w w.  ja  va2 s  . c om
        this.properties = null;
    }
}

From source file:co.cask.cdap.etl.spec.PluginSpec.java

public PluginSpec(String type, String name, Map<String, String> properties, ArtifactId artifact) {
    this.type = type;
    this.name = name;
    this.properties = ImmutableMap.copyOf(properties);
    this.artifact = artifact;
}

From source file:models.generic.ModelWithExternalReference.java

public Map<String, String> externalReferences() {
    return ImmutableMap.copyOf(externalReferences);
}

From source file:com.facebook.buck.testutil.endtoend.BuckInvoker.java

private void assumeWatchman() {
    try {//from   w w  w .  j  av a 2  s  . c  o m
        executableFinder.getExecutable(Paths.get("watchman"),
                ImmutableMap.copyOf(testDescriptor.getVariableMap()));
    } catch (HumanReadableException e) {
        Assume.assumeNoException("watchman not found, skipping buckd test", e);
    }
}

From source file:se.sics.caracaldb.operations.OpUtil.java

/**
 * Puts value if there's no value associated with key currently.
 * //w  w w .java 2s. c om
 * @param id
 * @param key
 * @param value
 * @return 
 */
public static MultiOpRequest putIfAbsent(UUID id, Key key, byte[] value) {
    Condition c = new EqualCondition(key, null);
    return new MultiOpRequest(id, ImmutableSet.of(c), ImmutableMap.of(key, value),
            ImmutableMap.copyOf(new HashMap<Key, byte[]>())); // see above
}

From source file:com.facebook.presto.metadata.BoundVariables.java

public BoundVariables(Map<String, Type> typeVariables, Map<String, Long> longVariables) {
    requireNonNull(typeVariables, "typeVariableBindings is null");
    requireNonNull(longVariables, "longVariableBindings is null");
    this.typeVariables = ImmutableMap.copyOf(typeVariables);
    this.longVariables = ImmutableMap.copyOf(longVariables);
}

From source file:io.prestosql.plugin.redis.decoder.hash.HashRedisRowDecoder.java

public HashRedisRowDecoder(Map<DecoderColumnHandle, RedisFieldDecoder<String>> fieldDecoders) {
    this.fieldDecoders = ImmutableMap.copyOf(fieldDecoders);
}