Class Filter


  • public class Filter
    extends java.lang.Object
    Java API (not recommended): Callback for the Future.filter operation that creates a new Future which will conditionally contain the success of another Future.

    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 org.apache.pekko.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&rsquo;s for-comprehensions, thus Java users should prefer Future.map, translating non-matching values to failure cases.

    • Constructor Summary

      Constructors 
      Constructor Description
      Filter()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> scala.Function1<T,​java.lang.Object> filterOf​(Function<T,​java.lang.Boolean> f)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Filter

        public Filter()
    • Method Detail

      • filterOf

        public static <T> scala.Function1<T,​java.lang.Object> filterOf​(Function<T,​java.lang.Boolean> f)