本文整理了Java中io.vavr.collection.Map.getOrElse()
方法的一些代码示例,展示了Map.getOrElse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Map.getOrElse()
方法的具体详情如下:
包路径:io.vavr.collection.Map
类名称:Map
方法名:getOrElse
[英]Returns the value associated with a key, or a default value if the key is not contained in the map.
[中]返回与键关联的值,如果映射中不包含该键,则返回默认值。
代码示例来源:origin: vavr-io/vavr
@Override
@SuppressWarnings("unchecked")
public Traversable<V> getOrElse(K key, Traversable<? extends V> defaultValue) {
return back.getOrElse(key, (Traversable<V>) defaultValue);
}
代码示例来源:origin: apache/incubator-pinot
String offlineKey = commonOfflineAndRealtimeKey + ".offline";
Object realtimeValue = remappedConfig.getOrElse(realtimeKey, null);
Object offlineValue = remappedConfig.getOrElse(offlineKey, null);
代码示例来源:origin: jdbi/jdbi
@Override
public Collector<?, ?, ?> build(Type containerType) {
Class<?> erasedType = getCollectionType(containerType);
return collectors.getOrElse(erasedType,
Lazy.val(() -> resolveDefaultCollector(erasedType).get(), Collector.class));
}
}
代码示例来源:origin: apache/incubator-pinot
@Override
public Map<String, ?> unhandleChildKeys(java.util.List<T> values, String pathPrefix) {
if (values == null) {
return null;
}
return List.ofAll(values).flatMap(value -> {
Map<String, ?> serializedValue = Serializer.serialize(value);
final String name = (String) serializedValue.getOrElse("name", null);
return serializedValue.remove("name").mapKeys(key -> name + "." + key);
}).toMap(Function.identity());
}
}
代码示例来源:origin: apache/incubator-pinot
if (tableName.isDefined() && config.getOrElse("table.schemaName", null) == null) {
config = ((Map<String, Object>) config).put("table.schemaName", tableName.get());
代码示例来源:origin: apache/incubator-pinot
SingleKeyDsl dsl = dslInfo.dsl().newInstance();
if (config.containsKey(keyName)) {
Object dslValue = dsl.parse(config.getOrElse(keyName, null).toString());
Map<String, ?> dslValues = Serializer.serialize(dslValue);
coerceValueIntoField(rootObject, declaredField, dslValues.getOrElse(dslInfo.value(), null));
valueInjected |= coerceValueIntoField(rootObject, declaredField, config.getOrElse(keyName, null));
} else {
代码示例来源:origin: apache/incubator-pinot
Map<String, Object> dslValue = dslValues.getOrElse(keyName, HashMap.empty());
dslValue = dslValue.put(useDsl.value(), field.get(object));
dslValues = dslValues.put(keyName, dslValue);
final Map<String, String> dslUnparsedValues = dslValues.flatMap((configKey, dslValueData) -> {
try {
Class<? extends SingleKeyDsl> dslClass = finalDslClasses.getOrElse(configKey, null);
SingleKeyDsl dslInstance = dslClass.newInstance();
Class<?> dslValueType = dslClass.getMethod("parse", String.class).getReturnType();
代码示例来源:origin: io.vavr/vavr
@Override
@SuppressWarnings("unchecked")
public Traversable<V> getOrElse(K key, Traversable<? extends V> defaultValue) {
return back.getOrElse(key, (Traversable<V>) defaultValue);
}
内容来源于网络,如有侵权,请联系作者删除!