Example usage for com.google.common.collect ImmutableSortedMap copyOf

List of usage examples for com.google.common.collect ImmutableSortedMap copyOf

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSortedMap copyOf.

Prototype

public static <K, V> ImmutableSortedMap<K, V> copyOf(
            Iterable<? extends Entry<? extends K, ? extends V>> entries) 

Source Link

Usage

From source file:com.proofpoint.reporting.TaggedValue.java

static TaggedValue taggedValue(Map<String, String> tags, ValueAndTimestamp valueAndTimestamp) {
    return new AutoValue_TaggedValue(ImmutableSortedMap.copyOf(tags), valueAndTimestamp);
}

From source file:com.facebook.buck.cxx.CxxFlags.java

public static RuleKeyAppendableFunction<String, String> getTranslateMacrosFn(final CxxPlatform cxxPlatform) {

    final ImmutableSortedMap<String, String> flagMacros = ImmutableSortedMap
            .copyOf(cxxPlatform.getFlagMacros());

    return new RuleKeyAppendableFunction<String, String>() {

        @Override/*  ww  w. j ava2 s .  c  o  m*/
        public void appendToRuleKey(RuleKeyObjectSink sink) {
            SortedMap<String, String> sanitizedMap = Maps.transformValues(flagMacros,
                    cxxPlatform.getCompilerDebugPathSanitizer().sanitize(Optional.empty()));
            sink.setReflectively("flagMacros", sanitizedMap);
        }

        @Override
        public String apply(String flag) {
            // TODO(agallager): We're currently tied to `$VARIABLE` style of macros as much of the apple
            // support relies on this.  Long-term though, we should make this consistent with the
            // `$(macro ...)` style we use in the rest of the codebase.
            for (Map.Entry<String, String> entry : flagMacros.entrySet()) {
                flag = flag.replace("$" + entry.getKey(), entry.getValue());
            }
            return flag;
        }
    };
}

From source file:com.opengamma.strata.pricer.option.TenorRawOptionData.java

/**
 * Obtains an instance of the raw volatility.
 * <p>//from ww  w.ja va  2  s  .  co m
 * The data values can be model parameters (like Black or normal volatilities) or direct option prices.
 * 
 * @param data  the map of data by tenor
 * @return the instance
 */
public static TenorRawOptionData of(Map<Tenor, RawOptionData> data) {
    return new TenorRawOptionData(ImmutableSortedMap.copyOf(data));
}

From source file:com.google.caliper.runner.experiment.Experiment.java

/** Creates a new {@link Experiment}. */
public static Experiment create(int id, InstrumentedMethod instrumentedMethod,
        Map<String, String> userParameters, Target target) {
    BenchmarkSpec benchmarkSpec = createBenchmarkSpec(instrumentedMethod, userParameters);
    return new AutoValue_Experiment(id, instrumentedMethod, ImmutableSortedMap.copyOf(userParameters), target,
            benchmarkSpec);/*from  w  ww  . j  ava 2s.c  om*/
}

From source file:com.facebook.buck.util.MoreMaps.java

public static <K, V> ImmutableSortedMap<K, V> mergeSorted(Map<K, V> first, Map<K, V> second) {
    Map<K, V> mutableMap = new HashMap<>(first);
    mutableMap.putAll(second);/*ww  w  .  j  a  v  a2 s  . co m*/
    return ImmutableSortedMap.copyOf(mutableMap);
}

From source file:com.dampcake.gson.immutable.ImmutableSortedMapAdapter.java

/**
 * @see DelegateAdapter#DelegateAdapter(TypeAdapter)
 *///ww  w .  j  a va2  s.  com
@Override
protected SortedMap<?, ?> transform(SortedMap<?, ?> map) {
    return ImmutableSortedMap.copyOf(map);
}

From source file:io.prestosql.plugin.ml.FeatureVector.java

public FeatureVector(Map<Integer, Double> features) {
    this.features = ImmutableSortedMap.copyOf(features);
}

From source file:io.airlift.configuration.ConfigurationLoader.java

public Map<String, String> loadProperties() throws IOException {
    Map<String, String> result = Maps.newTreeMap();
    String configFile = System.getProperty("config");
    if (configFile != null) {
        result.putAll(loadPropertiesFrom(configFile));
    }/*from  w ww  .j a  va 2s. c  o  m*/

    result.putAll(getSystemProperties());

    return ImmutableSortedMap.copyOf(result);
}

From source file:ec.tss.tsproviders.Util.java

static ImmutableSortedMap<String, String> toImmutable(Map<String, String> params) {
    switch (params.size()) {
    case 0://from   w  ww.j a  va 2  s .  c  o  m
        return ImmutableSortedMap.of();
    case 1:
        Map.Entry<String, String> first = params.entrySet().iterator().next();
        return ImmutableSortedMap.of(first.getKey(), first.getValue());
    default:
        return ImmutableSortedMap.copyOf(params);
    }
}

From source file:com.google.caliper.runner.Scenario.java

public Scenario(BenchmarkMethod benchmarkMethod, Map<String, String> userParameters, VirtualMachine vm) {
    this.benchmarkMethod = benchmarkMethod;
    this.userParameters = ImmutableSortedMap.copyOf(userParameters);
    this.vm = vm;
}