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.opendaylight.controller.remote.rpc.registry.gossip.GossipStatus.java

GossipStatus(final Address from, final Map<Address, Long> versions) {
    this.versions = ImmutableMap.copyOf(versions);
    this.from = from;
}

From source file:org.sakaiproject.kernel.util.MapUtils.java

/**
 * Converts a name value string delimited with = and ; into an immutable map.
 *
 * @param values//  www.j a  v a 2  s.  co  m
 *          the contents of the map
 * @return an immutable map.
 */
public static Map<String, String> convertToImmutableMap(String values) {
    Map<String, String> m = Maps.newHashMap();
    String[] templates = StringUtils.split(values, ';');
    if (templates != null) {
        for (String template : templates) {
            String[] nv = StringUtils.split(template, "=", 2);
            m.put(nv[0].trim(), nv[1].trim());
        }
    }
    return ImmutableMap.copyOf(m);
}

From source file:org.jpmml.evaluator.IndexableUtil.java

static public <K, E extends PMMLObject & Indexable<K>> ImmutableMap<K, E> buildMap(List<E> elements) {
    Map<K, E> result = new LinkedHashMap<>();

    for (E element : elements) {
        K key = ensureKey(element);/*from  w  w w .  j  av  a2  s  .  c  om*/

        if (result.containsKey(key)) {
            throw new InvalidFeatureException(element);
        }

        result.put(key, element);
    }

    return ImmutableMap.copyOf(result);
}

From source file:com.google.devtools.build.android.resources.FieldInitializers.java

/** Creates a {@link FieldInitializers} copying the contents from a {@link Map}. */
public static FieldInitializers copyOf(Map<ResourceType, Map<String, FieldInitializer>> initializers) {
    return new FieldInitializers(ImmutableMap.copyOf(initializers));
}

From source file:com.yahoo.bard.webservice.druid.model.dimension.extractionfunction.MapLookup.java

/**
 * Constructor./* www . j a  va2 s .  c o m*/
 *
 * @param mapping  dimension value key to target dimension value mapping provided by the user.
 */
public MapLookup(Map<String, String> mapping) {
    super("map");
    this.mapping = ImmutableMap.copyOf(mapping);
}

From source file:org.cobbzilla.mail.TemplatedMailKestrelConfiguration.java

public void setProperties(Map<String, String> properties) {
    this.properties = ImmutableMap.copyOf(properties);
}

From source file:org.jclouds.b2.domain.MultipartUploadResponse.java

@SerializedNames({ "accountId", "bucketId", "contentType", "fileId", "fileInfo", "fileName",
        "uploadTimestamp" })
public static MultipartUploadResponse create(String accountId, String bucketId, String contentType,
        String fileId, Map<String, String> fileInfo, String fileName, long uploadTimestamp) {
    return new AutoValue_MultipartUploadResponse(accountId, bucketId, contentType, fileId,
            ImmutableMap.copyOf(fileInfo), fileName, new Date(uploadTimestamp));
}

From source file:keywhiz.api.model.SecretSeries.java

public static SecretSeries of(long id, String name, @Nullable String description, ApiDate createdAt,
        @Nullable String createdBy, ApiDate updatedAt, @Nullable String updatedBy, @Nullable String type,
        @Nullable Map<String, String> generationOptions, @Nullable Long currentVersion) {
    ImmutableMap<String, String> options = (generationOptions == null) ? ImmutableMap.of()
            : ImmutableMap.copyOf(generationOptions);
    return new AutoValue_SecretSeries(id, name, nullToEmpty(description), createdAt, nullToEmpty(createdBy),
            updatedAt, nullToEmpty(updatedBy), Optional.ofNullable(type), options,
            Optional.ofNullable(currentVersion));
}

From source file:com.bigfatgun.fixjures.proxy.ObjectProxyData.java

public ObjectProxyData(Map<?, ?> map) {
    this.data = ImmutableMap.copyOf(map);
}

From source file:org.jclouds.azurecompute.arm.domain.NetworkSecurityGroup.java

@SerializedNames({ "id", "name", "location", "tags", "properties", "etag" })
public static NetworkSecurityGroup create(final String id, final String name, final String location,
        final Map<String, String> tags, final NetworkSecurityGroupProperties properties, final String etag) {
    return new AutoValue_NetworkSecurityGroup(id, name, location,
            (tags == null) ? null : ImmutableMap.copyOf(tags), properties, etag);
}