package com.lovecoding.day24.stream01;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

public class Test01 {

    //创建无限流**
    @Test
    public void test02(){
        //Stream.iterate(0,  integer -> {  return  integer+1; } ).forEach(System.out::println);

        Stream.generate(Math::random).forEach(System.out::println);
    }

    @Test
    public void test01(){
        //list
        List<Integer> integers = List.of(1, 2, 3, 4, 5, 6);
        //获取流
        Stream<Integer> stream = integers.stream();
        System.out.println(stream);

        //并行流
        Stream<Integer> integerStream = integers.parallelStream();

        //数组
        Object[] objects = integers.toArray();
        //Arrays 获取流

        Stream<Object> stream1 = Arrays.stream(objects);

        //Stream
        Stream<String> stringStream = Stream.of("1", "2", "3");


    }
}
