我有一个使用fj.data.List提供的List类型的函数式Java列表。
import fj.data.List
List<Long> managedCustomers
我正在尝试使用以下方式进行过滤:
managedCustomers.filter(customerId -> customerId == 5424164219L)
我收到了这条信息
根据文档,List有一个过滤方法,应该可以运行http://www.functionaljava.org/examples-java8.html 我错过了什么?谢谢
filter
方法。可以尝试使用.stream().filter(...).collect(toList())
,或者如果底层实现允许且想要修改原始列表,则使用managedCustomers.removeIf(id -> id != 5424164219L)
。 - Alexis C.