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:io.sidecar.org.Device.java

private Device(Builder builder) {
    userId = checkNotNull(builder.userId);

    checkArgument(isValidDeviceId(builder.deviceId),
            "Invalid DeviceId of %s - must be between 8-40 valid characters", builder.deviceId);
    deviceId = builder.deviceId;// www  . j a  v a  2  s.c o  m

    appId = checkNotNull(builder.appId);
    metadata = (builder.metadata == null) ? ImmutableMap.<String, String>of()
            : ImmutableMap.copyOf(builder.metadata);
}

From source file:com.netflix.metacat.plugin.mysql.MetacatMySqlPlugin.java

@Override
public void setOptionalConfig(final Map<String, String> optionalConfig) {
    this.optionalConfig = ImmutableMap
            .copyOf(Preconditions.checkNotNull(optionalConfig, "optionalConfig is null"));
}

From source file:org.sonatype.nexus.componentviews.config.ViewConfig.java

public ViewConfig(final String viewName, final String factoryName, final Map<String, Object> configuration) {
    this.viewName = checkNotNull(viewName);
    this.factoryName = checkNotNull(factoryName);
    this.configuration = ImmutableMap.copyOf(checkNotNull(configuration));
}

From source file:org.dishevelled.bio.assembly.gfa.GfaRecord.java

/**
 * Create a new GFA record with the specified tags.
 *
 * @param tags tags, must not be null/*from  w  ww . j  av a 2  s . co m*/
 */
protected GfaRecord(final Map<String, Tag> tags) {
    checkNotNull(tags);
    this.tags = ImmutableMap.copyOf(tags);
}

From source file:com.facebook.presto.execution.resourceGroups.StaticSelector.java

public StaticSelector(Optional<Pattern> userRegex, Optional<Pattern> sourceRegex,
        Map<String, Pattern> sessionPropertyRegexes, ResourceGroupIdTemplate group) {
    this.userRegex = requireNonNull(userRegex, "userRegex is null");
    this.sourceRegex = requireNonNull(sourceRegex, "sourceRegex is null");
    this.sessionPropertyRegexes = ImmutableMap
            .copyOf(requireNonNull(sessionPropertyRegexes, "sessionPropertyRegexes is null"));
    this.group = requireNonNull(group, "group is null");
}

From source file:com.eviware.loadui.util.statistics.store.TrackDescriptorImpl.java

public TrackDescriptorImpl(String trackId, Map<String, Class<? extends Number>> structure,
        EntryAggregator aggregator) {/*from www  . java  2s.com*/
    id = trackId;
    this.structure = ImmutableMap.copyOf(structure);
    this.aggregator = aggregator;
}

From source file:org.ambraproject.wombat.model.SearchFilterTypeMap.java

public SearchFilterTypeMap(Map<String, SearchFilterType> map) {
    this.map = ImmutableMap.copyOf(map);
}

From source file:org.apache.druid.indexing.kafka.KafkaPartitions.java

@JsonCreator
public KafkaPartitions(@JsonProperty("topic") final String topic,
        @JsonProperty("partitionOffsetMap") final Map<Integer, Long> partitionOffsetMap) {
    this.topic = topic;
    this.partitionOffsetMap = ImmutableMap.copyOf(partitionOffsetMap);

    // Validate partitionOffsetMap
    for (Map.Entry<Integer, Long> entry : partitionOffsetMap.entrySet()) {
        Preconditions.checkArgument(entry.getValue() >= 0,
                StringUtils.format("partition[%d] offset[%d] invalid", entry.getKey(), entry.getValue()));
    }/*w  w  w.  j  a v  a 2 s  . com*/
}

From source file:io.druid.java.util.metrics.JvmThreadsMonitor.java

public JvmThreadsMonitor(Map<String, String[]> dimensions, String feed) {
    super(feed);/*from  w w  w  . ja  v a2  s.c  om*/
    Preconditions.checkNotNull(dimensions);
    this.dimensions = ImmutableMap.copyOf(dimensions);
}

From source file:org.eclipse.mylyn.internal.wikitext.html.core.SpanStrategies.java

private static Map<SpanType, List<SpanType>> createSpanTypeToAlternatives() {
    Map<SpanType, List<SpanType>> alternatives = Maps.newHashMap();
    addAlternatives(alternatives, SpanType.BOLD, SpanType.STRONG);
    addAlternatives(alternatives, SpanType.STRONG, SpanType.BOLD);
    addAlternatives(alternatives, SpanType.CODE, SpanType.MONOSPACE);
    addAlternatives(alternatives, SpanType.EMPHASIS, SpanType.ITALIC);
    addAlternatives(alternatives, SpanType.INSERTED, SpanType.UNDERLINED);
    addAlternatives(alternatives, SpanType.ITALIC, SpanType.EMPHASIS);
    addAlternatives(alternatives, SpanType.MONOSPACE, SpanType.CODE);
    return ImmutableMap.copyOf(alternatives);
}