IntStream peek(IntConsumer action)
returns a stream consisting of the elements of this stream, performing the provided action.
peek
has the following syntax.
IntStream peek(IntConsumer action)
The following example shows how to use peek
.
import java.util.stream.IntStream; public class Main { public static void main(String[] args) { IntStream i = IntStream.rangeClosed(1,7); i.peek(System.out::println); } }