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:see.evaluation.scopes.ImmutableOverride.java

private Map<String, Object> nullSafeCopy(Map<String, ?> overrides) {
    if (overrides instanceof ImmutableMap<?, ?>)
        return ImmutableMap.copyOf(overrides);
    else//from   ww w  .  j  av a2  s .  com
        return Maps.newHashMap(overrides);
}

From source file:com.codeabovelab.dm.cluman.model.ImageDescriptorImpl.java

@lombok.Builder(builderClassName = "Builder")
private ImageDescriptorImpl(String id, Date created, ContainerConfig containerConfig,
        Map<String, String> labels) {
    this.id = id;
    this.created = created;
    this.containerConfig = containerConfig;
    this.labels = labels == null ? Collections.emptyMap() : ImmutableMap.copyOf(labels);
}

From source file:com.google.devtools.build.lib.testutil.FakeAttributeMapper.java

private FakeAttributeMapper(Map<String, FakeAttributeMapperEntry<?>> attrs) {
    super(null, null, null, null);
    this.attrs = ImmutableMap.copyOf(attrs);
}

From source file:com.google.copybara.git.FetchResult.java

FetchResult(ImmutableMap<String, GitReference> before, ImmutableMap<String, GitReference> after) {
    MapDifference<String, GitReference> diff = Maps.difference(before, after);
    deleted = ImmutableMap.copyOf(diff.entriesOnlyOnLeft());
    inserted = ImmutableMap.copyOf(diff.entriesOnlyOnRight());
    updated = ImmutableMap/*from   w w  w .j a  v a2 s .c  o m*/
            .copyOf(diff.entriesDiffering().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
                    v -> new RefUpdate(v.getValue().leftValue(), v.getValue().rightValue()))));
}

From source file:com.opengamma.engine.marketdata.live.InMemoryLKVLiveMarketDataProviderFactory.java

public InMemoryLKVLiveMarketDataProviderFactory(LiveDataFactory defaultFactory,
        Map<String, LiveDataFactory> namedFactories) {
    ArgumentChecker.notNull(defaultFactory, "defaultFactory");
    ArgumentChecker.notNull(namedFactories, "namedFactories");
    _defaultFactory = defaultFactory;//from   ww w .  ja v  a2  s.  c om
    _namedFactories = ImmutableMap.copyOf(namedFactories);

    String defaultFactoryName = null;
    for (Map.Entry<String, LiveDataFactory> namedFactoryEntry : namedFactories.entrySet()) {
        LiveDataFactory factory = namedFactoryEntry.getValue();
        if (defaultFactory == factory) {
            defaultFactoryName = namedFactoryEntry.getKey();
            continue;
        }
    }
    if (defaultFactoryName == null) {
        throw new OpenGammaRuntimeException("Default factory not found in named factories map");
    }

    List<String> providerNames = new ArrayList<>(_namedFactories.keySet());
    Collections.sort(providerNames);
    providerNames.remove(defaultFactoryName);
    providerNames.add(0, defaultFactoryName);
    _providerNames = ImmutableList.copyOf(providerNames);
}

From source file:co.cask.cdap.data.stream.service.heartbeat.StreamWriterHeartbeat.java

public StreamWriterHeartbeat(long timestamp, int instanceId, Map<Id.Stream, Long> streamsSizes) {
    this.timestamp = timestamp;
    this.instanceId = instanceId;
    this.streamsSizes = ImmutableMap.copyOf(streamsSizes);
}

From source file:org.pentaho.di.engine.model.Configurable.java

@Override
public Map<String, Serializable> getConfig() {
    return ImmutableMap.copyOf(config);
}

From source file:org.sonar.server.computation.task.projectanalysis.qualityprofile.ActiveRule.java

public ActiveRule(RuleKey ruleKey, String severity, Map<String, String> params, long createdAt) {
    this.ruleKey = ruleKey;
    this.severity = severity;
    this.params = ImmutableMap.copyOf(params);
    this.createdAt = createdAt;
}

From source file:com.arpnetworking.tsdcore.sinks.DimensionInjectingSink.java

/**
 * {@inheritDoc}/*w w  w . ja  v  a2s .  co m*/
 */
@Override
public void recordAggregateData(final PeriodicData data) {
    final Map<String, String> mergedDimensions = Maps.newHashMap(data.getDimensions());
    mergedDimensions.putAll(_dimensions);
    final PeriodicData.Builder dataBuilder = PeriodicData.Builder.clone(data);
    dataBuilder.setDimensions(ImmutableMap.copyOf(mergedDimensions));
    _sink.recordAggregateData(dataBuilder.build());
}

From source file:com.yfiton.core.NotifierRegistry.java

public ImmutableMap<String, Notifier> getAvailable() {
    return ImmutableMap.copyOf(availableNotifiers);
}