io.vavr.collection.Map.forEach()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(200)

本文整理了Java中io.vavr.collection.Map.forEach()方法的一些代码示例,展示了Map.forEach()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Map.forEach()方法的具体详情如下:
包路径:io.vavr.collection.Map
类名称:Map
方法名:forEach

Map.forEach介绍

[英]Performs an action on key, value pair.
[中]对键、值对执行操作。

代码示例

代码示例来源:origin: apache/incubator-pinot

@Override
public java.util.Map<String, String> handleChildKeys(Map<String, ?> childKeys, String pathPrefix) {
 java.util.Map<String, String> returnedMap = new HashMap<>();
 childKeys.forEach((key, value) -> returnedMap.put(key, value.toString()));
 if (returnedMap.isEmpty()) {
  return null;
 } else {
  return returnedMap;
 }
}

代码示例来源:origin: apache/incubator-pinot

@Override
public Map<String, Map<String, String>> handleChildKeys(io.vavr.collection.Map<String, ?> childKeys,
  String pathPrefix) {
 Map<String, Map<String, String>> returnValue = new java.util.HashMap<>();
 // Deserialize task keys for tasks that have no config
 childKeys.filter((key, value) -> key.indexOf('.') == -1)
   .forEach((key, value) -> returnValue.put(key, new java.util.HashMap<>()));
 if (returnValue.isEmpty()) {
  return null;
 } else {
  return returnValue;
 }
}

代码示例来源:origin: apache/incubator-pinot

@Override
public java.util.Map<String, T> handleChildKeys(Map<String, ?> childKeys, String pathPrefix) {
 java.util.Map<String, T> returnedMap = new HashMap<>();
 childKeys.groupBy(tuple2 -> tuple2._1.split("\\.", 2)[0]).map((key, values) -> {
  // Drop the prefix
  Map<String, ?> valuesWithoutPrefix =
    values.map((configKey, configValue) -> Tuple.of(configKey.substring(key.length() + 1), configValue));
  T value;
  try {
   value = Deserializer.deserialize(_type, valuesWithoutPrefix, "");
  } catch (Exception e) {
   value = null;
   e.printStackTrace();
  }
  return Tuple.of(key, value);
 }).forEach(returnedMap::put);
 if (returnedMap.isEmpty()) {
  return null;
 } else {
  return returnedMap;
 }
}

代码示例来源:origin: ch.netzwerg/paleo-core

public void putAllMetaData(Map<String, String> metaData) {
  Objects.requireNonNull(metaData, "metaData is null");
  metaData.forEach(t -> this.metaData.put(t._1, t._2));
}

代码示例来源:origin: netzwerg/paleo

public void putAllMetaData(Map<String, String> metaData) {
  Objects.requireNonNull(metaData, "metaData is null");
  metaData.forEach(t -> this.metaData.put(t._1, t._2));
}

代码示例来源:origin: com.io7m.changelog/com.io7m.changelog.xml.vanilla

this.writeRelease(doc, releases, version, release));
changelog.ticketSystems().forEach(
 (name, ticket_uri) ->
  this.writeTicketSystem(doc, ticket_systems, name, ticket_uri));

相关文章