@Test public void testFilterTransducer() { StreamSupplier<Integer> supplier = StreamSupplier.of(1, 2, 3, 4, 5, 6); StreamTransducer<Integer, Integer> filter = StreamTransducer.create(filter(input -> input % 2 == 1)); StreamConsumerToList<Integer> consumer = StreamConsumerToList.create(); await(supplier.transformWith(filter) .streamTo(consumer.transformWith(randomlySuspending()))); assertEquals(asList(1, 3, 5), consumer.getList()); assertEndOfStream(supplier); assertEndOfStream(filter); }
public static <I, O> StreamTransducer<I, O> create(Transducer<I, O, ?> transducer) { return new StreamTransducer<>(transducer); }
StreamTransducer implements StreamTransformer<I, O> { public static <I, O> StreamTransducer<I, O> create(Transducer<I, O, ?> transducer) { return new StreamTransducer<>(transducer); } }
StreamTransducer implements StreamTransformer<I, O> { public static <I, O> StreamTransducer<I, O> create(Transducer<I, O, ?> transducer) { return new StreamTransducer<>(transducer); } private  StreamTransducer(Transducer<I, O, ?> transducer); }
StreamTransducer implements StreamTransformer<I, O> { public static <I, O> StreamTransducer<I, O> create(Transducer<I, O, ?> transducer) { return new StreamTransducer<>(transducer); } private  StreamTransducer(Transducer<I, O, ?> transducer); static StreamTransducer<I, O> create(Transducer<I, O, ?> transducer); @Override StreamConsumer<I> getInput(); @Override StreamSupplier<O> getOutput(); }
StreamTransducer implements StreamTransformer<I, O> { public static <I, O> StreamTransducer<I, O> create(Transducer<I, O, ?> transducer) { return new StreamTransducer<>(transducer); } private  StreamTransducer(Transducer<I, O, ?> transducer); static StreamTransducer<I, O> create(Transducer<I, O, ?> transducer); @Override StreamConsumer<I> getInput(); @Override StreamSupplier<O> getOutput();  }