@Test public void testMapperTransducer() { StreamSupplier<Integer> supplier = StreamSupplier.of(1, 2, 3); StreamConsumerToList<Integer> consumer = StreamConsumerToList.create(); StreamTransducer<Integer, Integer> mapper = StreamTransducer.create(Transducer.mapper(input -> input * input)); await(supplier.transformWith(mapper) .streamTo(consumer.transformWith(oneByOne()))); assertEquals(asList(1, 4, 9), consumer.getList()); assertEndOfStream(supplier); assertEndOfStream(mapper); assertEndOfStream(consumer); }
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();  }