【发布时间】:2019-08-07 20:48:58
【问题描述】:
我想使用 List.distinctBy 过滤由 (Javaslang) 提供的列表 我在 pom.xml 中添加了这个依赖项
<dependency>
<groupId>io.vavr</groupId>
<artifactId>vavr-kotlin</artifactId>
<version>0.10.0</version>
但是当我在代码中使用它时
menuPriceByDayService
.findAllOrderByUpdateDate(menu, DateUtils.semestralDate(), 26)
.stream()
.distinctBy(MenuPriceByDay::getUpdateLocalDate)
.map(cp -> cp.getUpdateLocalDate())
.sorted()
.forEach(System.out::println);
我有一个编译错误:
The method distinctBy(MenuPriceByDay::getUpdateLocalDate) is undefined for the type
Stream<MenuPriceByDay>
【问题讨论】:
标签: java collections functional-programming java-stream vavr