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:com.netflix.spinnaker.clouddriver.core.limits.ServiceLimits.java

public ServiceLimits(Map<String, Double> limits) {
    this.limits = limits == null ? Collections.emptyMap() : ImmutableMap.copyOf(limits);
}

From source file:org.opendaylight.controller.remote.rpc.registry.gossip.GossipEnvelope.java

GossipEnvelope(final Address from, final Address to, final Map<Address, ? extends Bucket<?>> buckets) {
    this.to = Preconditions.checkNotNull(to);
    this.buckets = ImmutableMap.copyOf(buckets);
    this.from = from;
}

From source file:local.laer.app.newgenerator.domain.LayoutResource.java

@JsonCreator
public LayoutResource(Map<LayoutFormat, String> uriMap) {
    this.uriMap = ImmutableMap.copyOf(uriMap);
}

From source file:org.glowroot.plugin.servlet.HttpSessions.java

static ImmutableMap<String, String> getSessionAttributes(HttpSession session) {
    Set<String> capturePaths = ServletPluginProperties.captureSessionAttributePaths();
    if (capturePaths.isEmpty()) {
        return ImmutableMap.of();
    }/*from  ww  w.  j av  a  2  s.c o  m*/
    Map<String, String> captureMap = Maps.newHashMap();
    // dump only http session attributes in list
    for (String capturePath : capturePaths) {
        if (capturePath.equals("*")) {
            captureAllSessionAttributes(session, captureMap);
        } else if (capturePath.endsWith(".*")) {
            captureWildcardPath(session, captureMap, capturePath.substring(0, capturePath.length() - 2));
        } else {
            captureNonWildcardPath(session, captureMap, capturePath);
        }
    }
    return ImmutableMap.copyOf(captureMap);
}

From source file:org.eclipse.milo.opcua.binaryschema.Struct.java

public Struct(@Nonnull String name, @Nonnull Map<String, Member> members) {
    this(name, ImmutableMap.copyOf(members));
}

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

/**
 * Check and Set operation.//from  w w  w . j  a  v  a2s  .  co m
 * 
 * If value@key == oldValue set value@key = newValue.
 * 
 * @param k
 * @param oldValue
 * @param newValue
 * @return 
 */
public static MultiOpRequest cas(UUID id, Key key, byte[] oldValue, byte[] newValue) {
    Condition c = new EqualCondition(key, oldValue);
    return new MultiOpRequest(id, ImmutableSet.of(c), ImmutableMap.of(key, newValue),
            ImmutableMap.copyOf(new HashMap<Key, byte[]>())); // java6 is soooooo baaaadd -.-
}

From source file:com.google.devtools.build.lib.rules.ToolchainProvider.java

public static ImmutableMap<String, String> getToolchainMakeVariables(RuleContext ruleContext,
        String attributeName) {/*from   w  w  w. j av  a2 s .  co  m*/
    // Cannot be an ImmutableMap.Builder because we want to support duplicate keys
    TreeMap<String, String> result = new TreeMap<>();
    for (ToolchainProvider provider : ruleContext.getPrerequisites(attributeName, Mode.TARGET,
            ToolchainProvider.class)) {
        result.putAll(provider.getMakeVariables());
    }

    return ImmutableMap.copyOf(result);
}

From source file:io.airlift.drift.idl.generator.ThriftTypeRenderer.java

public ThriftTypeRenderer(Map<ThriftType, String> typeNames) {
    this.typeNames = ImmutableMap.copyOf(typeNames);
}

From source file:us.swcraft.springframework.session.messages.SessionAttributes.java

public SessionAttributes(Map<String, Object> attributes) {
    this.attributes = ImmutableMap.copyOf(attributes);
}

From source file:com.google.devtools.build.lib.rules.MakeVariableProvider.java

public static ImmutableMap<String, String> getToolchainMakeVariables(RuleContext ruleContext,
        String attributeName) {//from  w  w  w  .  j  a v  a 2s . c  o  m
    // Cannot be an ImmutableMap.Builder because we want to support duplicate keys
    TreeMap<String, String> result = new TreeMap<>();
    for (MakeVariableProvider provider : ruleContext.getPrerequisites(attributeName, Mode.TARGET,
            MakeVariableProvider.class)) {
        result.putAll(provider.getMakeVariables());
    }

    return ImmutableMap.copyOf(result);
}