package com.shrimpking.t3;

import java.util.stream.Stream;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Shrimpking
 * @create 2024/9/11 16:08
 */
public class PeekStream
{
    public static void main(String[] args)
    {
        Stream<Integer> stream = Stream.of(3,1,-5,-2,2);
        stream.filter(e -> e > 0)
                .peek(x -> System.out.println("Filtered value:" + x))
                .limit(3)
                .peek(y -> System.out.println("Limited value:" + y))
                .forEach(z -> System.out.println("foreach:" + z));

    }
}