consumes the given publisher 's items to a list . this method can be useful when testing , but should be uses with care in production code as it will exhaust memory if the stream is very large . import org.reactivestreams.publisher ; import ratpack.stream.streams ; import ratpack.test.exec.execharness ; import java.util.arrays ; import java.util.list ; import static org.junit.assert. ; public class example public static void main string ... args throws exception list expected = arrays.aslist `` a '' , `` b '' , `` c '' ; list result = execharness.yieldsingle execcontrol - > streams.publish expected . tolist . getvalue ; assertequals arrays.aslist `` a '' , `` b '' , `` c '' , result ; if the publisher emits an error , the promise will fail and the collected items will be discarded . import org.reactivestreams.publisher ; import ratpack.stream.streams ; import ratpack.test.exec.execharness ; import static org.junit.assert. ; public class example public static void main string ... args throws exception throwable error = execharness.yieldsingle execcontrol - > streams.yield r - > if r.getrequestnum concode_field_sep PlaceHolder placeHolder concode_field_sep Promise<R> reduce concode_elem_sep TransformablePublisher<O> flatMap concode_elem_sep TransformablePublisher<T> filter concode_elem_sep TransformablePublisher<O> transform concode_elem_sep TransformablePublisher<O> streamMap concode_elem_sep TransformablePublisher<O> streamMap concode_elem_sep TransformablePublisher<T> wiretap concode_elem_sep TransformablePublisher<T> bindExec concode_elem_sep TransformablePublisher<T> buffer concode_elem_sep TransformablePublisher<T> gate concode_elem_sep TransformablePublisher<O> map concode_elem_sep TransformablePublisher<T> multicast concode_elem_sep Promise<T> toPromise
Promise < List < T >> function ( ) { return Streams . toList ( this ) ; }