@Test public void testFunction() { StreamSupplier<Integer> supplier = StreamSupplier.of(1, 2, 3); StreamConsumerToList<Integer> consumer = StreamConsumerToList.create(); StreamMapper<Integer, Integer> mapper = StreamMapper.create(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> StreamMapper<I, O> create(Function<I, O> function) { return new StreamMapper<>(function); }
StreamMapper implements StreamTransformer<I, O> { public static <I, O> StreamMapper<I, O> create(Function<I, O> function) { return new StreamMapper<>(function); } }
StreamMapper implements StreamTransformer<I, O> { public static <I, O> StreamMapper<I, O> create(Function<I, O> function) { return new StreamMapper<>(function); } private  StreamMapper(Function<I, O> function); }
StreamMapper implements StreamTransformer<I, O> { public static <I, O> StreamMapper<I, O> create(Function<I, O> function) { return new StreamMapper<>(function); } private  StreamMapper(Function<I, O> function); static StreamMapper<I, O> create(Function<I, O> function); @Override StreamConsumer<I> getInput(); @Override StreamSupplier<O> getOutput(); }
StreamMapper implements StreamTransformer<I, O> { public static <I, O> StreamMapper<I, O> create(Function<I, O> function) { return new StreamMapper<>(function); } private  StreamMapper(Function<I, O> function); static StreamMapper<I, O> create(Function<I, O> function); @Override StreamConsumer<I> getInput(); @Override StreamSupplier<O> getOutput();  }