public class Filter$
extends java.lang.Object
Unfortunately it is not possible to express the type of a Scala filter in
Java: Function1[T, Boolean], where “Boolean” is the primitive type. It is
possible to use Future.filter
by constructing such a function indirectly:
import static akka.dispatch.Filter.filterOf;
Future<String> f = ...;
f.filter(filterOf(new Function<String, Boolean>() {
@Override
public Boolean apply(String s) {
...
}
}));
However, Future.filter
exists mainly to support Scala’s for-comprehensions,
thus Java users should prefer Future.map
, translating non-matching values
to failure cases.
Modifier and Type | Field and Description |
---|---|
static Filter$ |
MODULE$
Static reference to the singleton instance of this Scala object.
|
Constructor and Description |
---|
Filter$() |
Modifier and Type | Method and Description |
---|---|
<T> scala.Function1<T,java.lang.Object> |
filterOf(Function<T,java.lang.Boolean> f) |