Commits

Stepan Koltsov committed 76c0872

convenient IteratorF.flatMapO method

  • Participants
  • Parent commits 8bffa3e

Comments (0)

Files changed (2)

src/main/java/ru/yandex/bolts/collection/IteratorF.java

 
     <B> IteratorF<B> flatMapL(Function<? super E, ? extends Iterable<B>> f);
 
+    <B> IteratorF<B> flatMapO(Function<? super E, Option<B>> f);
+
     IteratorF<E> filter(Function1B<? super E> f);
 
     IteratorF<E> filterW(@FunctionParameter E f);

src/main/java/ru/yandex/bolts/collection/impl/AbstractIteratorF.java

         return flatMap(g);
     }
 
+    @Override
+    public <B> IteratorF<B> flatMapO(Function<? super E, Option<B>> f) {
+        return flatMapL(f);
+    }
+
     private static abstract class AbstractPrefetchingIterator<E> extends AbstractIteratorF<E> {
         private Option<E> next = Option.none();
         private boolean eof = false;