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:se.kth.climate.fast.netcdf.DataDescriptor.java

public DataDescriptor(MetaInfo mi, Set<String> vars, Map<String, DimensionRange> dims,
        Optional<String> splitDim) {
    this.metaInfo = mi;
    this.vars = ImmutableSet.copyOf(vars);
    this.dims = ImmutableMap.copyOf(dims);
    this.splitDim = splitDim;
}

From source file:org.hawkular.metrics.core.api.DataPoint.java

public DataPoint(long timestamp, T value, Map<String, String> tags) {
    this.timestamp = timestamp;
    this.value = value;
    this.tags = ImmutableMap.copyOf(tags);
}

From source file:org.auraframework.impl.util.AuraUtil.java

/**
 * Accepts a Map, or null, and always returns an immutable Map. If map was
 * null, return will be an empty ImmutableMap
 * /*from  w w w  . j a va2 s  .c  o  m*/
 * @param <K> Any Object type
 * @param <V> Any Object type
 * @param map Any Map, or null
 * @return An ImmutableMap that is a copy of map, or an empty ImmutableMap
 *         if map was null
 */
public static <K, V> Map<K, V> immutableMap(Map<K, V> map) {
    if (map == null) {
        return ImmutableMap.of();
    } else {
        return ImmutableMap.copyOf(map);
    }
}

From source file:org.codeseed.common.config.ConfigurationHandler.java

ConfigurationHandler(PropertySource source, Map<Type, Converter<String, ?>> converters) {
    this.source = checkNotNull(source);
    this.converters = ImmutableMap.copyOf(converters);
}

From source file:uk.co.caprica.brue.okhttp.service.bridge.SensorServiceImpl.java

@Override
public Map<Integer, Sensor> sensors() {
    return ImmutableMap.copyOf(getResource(resourceUrl(), sensorMapTypeReference));
}

From source file:me.lucko.luckperms.utils.LocaleManager.java

@SuppressWarnings("unchecked")
public void loadFromFile(File file) throws Exception {
    @Cleanup//from   ww w  .  j av a2s .  co m
    FileReader fileReader = new FileReader(file);
    translations = ImmutableMap.copyOf((Map<String, String>) new Yaml().load(fileReader));
}

From source file:org.apache.brooklyn.location.jclouds.JcloudsLocationResolver.java

private static Map<String, ProviderMetadata> getProvidersMap() {
    Map<String, ProviderMetadata> result = Maps.newLinkedHashMap();
    for (ProviderMetadata p : Providers.all()) {
        result.put(p.getId(), p);/*w  w  w .j  a v  a  2s.  c o m*/
    }
    return ImmutableMap.copyOf(result);
}

From source file:org.apache.druid.java.util.metrics.JvmThreadsMonitor.java

public JvmThreadsMonitor(Map<String, String[]> dimensions, String feed) {
    super(feed);/*w w  w.j a  v  a 2  s  . co m*/
    Preconditions.checkNotNull(dimensions, "dimensions");
    this.dimensions = ImmutableMap.copyOf(dimensions);
}

From source file:com.cognifide.aet.communication.api.metadata.StepResult.java

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

From source file:com.facebook.presto.sql.planner.assertions.SpecificationProvider.java

SpecificationProvider(List<SymbolAlias> partitionBy, List<SymbolAlias> orderBy,
        Map<SymbolAlias, SortOrder> orderings) {
    this.partitionBy = ImmutableList.copyOf(requireNonNull(partitionBy, "partitionBy is null"));
    this.orderBy = ImmutableList.copyOf(requireNonNull(orderBy, "orderBy is null"));
    this.orderings = ImmutableMap.copyOf(requireNonNull(orderings, "orderings is null"));
}