take
Pass n
incoming elements downstream and then complete
Signature¶
Description¶
Pass n
incoming elements downstream and then complete
Example¶
sourceSource(1 to 5).take(3).runForeach(println)
// 1
// 2
// 3
sourceSource.from(Arrays.asList(1, 2, 3, 4, 5)).take(3).runForeach(System.out::println, system);
// this will print:
// 1
// 2
// 3
Reactive Streams semantics¶
emits while the specified number of elements to take has not yet been reached
backpressures when downstream backpressures
completes when the defined number of elements has been taken or upstream completes
1.1.3