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

x33g5p2x  于2022-01-20 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(236)

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

HashMap.map介绍

暂无

代码示例

代码示例来源:origin: vavr-io/vavr

@Override
public <V2> HashMap<K, V2> mapValues(Function<? super V, ? extends V2> valueMapper) {
  Objects.requireNonNull(valueMapper, "valueMapper is null");
  return map((k, v) -> Tuple.of(k, valueMapper.apply(v)));
}

代码示例来源:origin: vavr-io/vavr

@Override
public <K2> HashMap<K2, V> mapKeys(Function<? super K, ? extends K2> keyMapper) {
  Objects.requireNonNull(keyMapper, "keyMapper is null");
  return map((k, v) -> Tuple.of(keyMapper.apply(k), v));
}

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

@Override
 public io.vavr.collection.Map<String, ?> unhandleChildKeys(Map<String, Map<String, String>> value,
   String pathPrefix) {
  HashMap<String, String> retVal = HashMap.ofAll(value).flatMap((taskKey, configs) -> {
   if (!configs.isEmpty()) {
    return HashMap.ofAll(configs).map((configKey, configValue) -> Tuple.of(taskKey + "." + configKey, configValue));
   } else {
    return HashMap.of(taskKey, "");
   }
  });

  return retVal;
 }
}

代码示例来源:origin: io.vavr/vavr

@Override
public <V2> HashMap<K, V2> mapValues(Function<? super V, ? extends V2> valueMapper) {
  Objects.requireNonNull(valueMapper, "valueMapper is null");
  return map((k, v) -> Tuple.of(k, valueMapper.apply(v)));
}

代码示例来源:origin: io.vavr/vavr

@Override
public <K2> HashMap<K2, V> mapKeys(Function<? super K, ? extends K2> keyMapper) {
  Objects.requireNonNull(keyMapper, "keyMapper is null");
  return map((k, v) -> Tuple.of(keyMapper.apply(k), v));
}

代码示例来源:origin: daggerok/spring-5-examples

@Bean
 InitializingBean initDB() {
  return () -> HashMap.of(123, "ololo",
              456, "trololo")
            .map((orderNumber, description) -> Tuple.of(BigDecimal.valueOf(orderNumber * System.currentTimeMillis() / 1234567890.987654321),
                                  singletonList(description)))
            .map(t -> Order.of(OrderNumber.of(t._1().intValue()), Price.of(t._1())))
            .forEach(orderRepository::save);
 }
}

相关文章