我仍然没有找到在AkkaStreams中进行“过滤”流程的简便方法。使用fromFunction对我来说很容易执行“映射”流程,但是对我却不行。在RxJava / Reactor中,在Flowable / Observable上有一个组合运算符,它将一个功能从一个Flowable转换为另一个Flowable,因此可以将转换描述为一连串的运算符,当然,我需要的是Source上的filter运算符对于过滤流,但是我不清楚如何定义过滤流,尽管很显然,对我来说,如何过滤源很容易。请指教
// Filter elements which are even (use the modulo operator: `%`)
def filterEvenValues: Flow[Int, Int, NotUsed] =
Flow.apply.filter(number => number % 2 == 0)