List of usage examples for com.google.common.collect Maps transformValues
@GwtIncompatible("NavigableMap") public static <K, V1, V2> NavigableMap<K, V2> transformValues(NavigableMap<K, V1> fromMap, Function<? super V1, V2> function)
From source file:com.noorq.casser.support.Transformers.java
public static <I, O, K> Map<K, O> transformMapValue(Map<K, I> inputMap, Function<I, O> func) { return Maps.transformValues(inputMap, func::apply); }
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/*from w w w.j a va2 s. co 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:org.polarsys.reqcycle.jdt.traceability.JDTPreferences.java
public static void savePreferences(Map<String, TType> map) { IConfigurationManager manager = ZigguratInject.make(IConfigurationManager.class); Map<String, Object> newMap = new HashMap<String, Object>( Maps.transformValues(map, Functions.toStringFunction())); try {/*from www. j a v a 2 s . co m*/ manager.saveSimpleConfiguration(newMap, null, null, JDT_TYPES_CONSTANT); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.cloudera.oryx.kmeans.computation.covariance.DistanceData.java
public static Map<ClusterKey, DistanceData> load(String prefix, int n) throws IOException { Map<ClusterKey, CovarianceDataBuilder> db = Maps.newHashMap(); Store store = Store.get();/*w w w .jav a 2 s. co m*/ for (String file : store.list(prefix, true)) { for (String line : new FileLineIterable(store.readFrom(file))) { CovarianceData cd = CovarianceData.parse(line); ClusterKey key = new ClusterKey(cd.getClusteringId(), cd.getCenterId()); CovarianceDataBuilder cdb = db.get(key); if (cdb == null) { cdb = new CovarianceDataBuilder(n); db.put(key, cdb); } cdb.update(cd); } } return Maps.transformValues(db, new Function<CovarianceDataBuilder, DistanceData>() { @Override public DistanceData apply(CovarianceDataBuilder input) { return input.getDistanceData(); } }); }
From source file:forms.meta.MetaFormValidation.java
static Map<String, String> mutantToMap(Mutant mutant) { return Maps.transformValues(mutant.toMap(), Mutant::value); }
From source file:org.jfrog.bamboo.context.GradleBuildContext.java
public static GradleBuildContext createGradleContextFromMap(Map<String, Object> map) { Map<String, String> transformed = Maps.transformValues(map, new Function<Object, String>() { @Override/*from ww w. j av a2s. c om*/ public String apply(Object input) { if (input == null) { return ""; } return input.toString(); } }); return new GradleBuildContext(transformed); }
From source file:org.n52.iceland.util.Producers.java
public static <K, T> Map<K, T> produce(Map<K, Producer<T>> map) { return Maps.transformValues(map, Producers.<T>producingFunction()); }
From source file:org.apache.fluo.core.impl.TxStringUtil.java
private static Map<String, Map<Column, String>> transform(Map<Bytes, Map<Column, Bytes>> rcvs) { Map<String, Map<Column, String>> ret = new HashMap<>(rcvs.size()); for (Entry<Bytes, Map<Column, Bytes>> entry : rcvs.entrySet()) { ret.put(entry.getKey().toString(), Maps.transformValues(entry.getValue(), B2S)); }/*from w w w . ja v a2s . c o m*/ return ret; }
From source file:io.fabric8.jube.process.support.ByteToStringValues.java
@Override public Map<String, String> apply(Map<String, byte[]> input) { return Maps.transformValues(input, new Function<byte[], String>() { @Override//from w w w .j a v a 2 s . c o m public String apply(byte[] input) { return new String(input, Charsets.UTF_8); } }); }
From source file:io.fabric8.process.manager.support.ByteToStringValues.java
@Override public Map<String, String> apply(java.util.Map<String, byte[]> input) { return Maps.transformValues(input, new Function<byte[], String>() { @Override//from w w w .java2 s .co m public String apply(byte[] input) { return new String(input, Charsets.UTF_8); } }); }