package J20250724.demo02_function_program;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author WanJl
 * @version 1.0
 * @title Demo06
 * @description
 * @create 2025/7/24
 */
public class Demo06 {
    public static void main(String[] args) {
        List<Actor> actors=new ArrayList<>();
        actors.add(new Actor("周华健"));
        actors.add(new Actor("周润发"));
        actors.add(new Actor("周一位"));
        actors.add(new Actor("周节流"));
        System.out.println(actors);
        //把一个演员类的集合里的所有演员对象的姓名抽取出来，编程一个新的集合。
        List<String> stringList = actors.stream()
                .map(actor -> actor.getName())
                .collect(Collectors.toList());
        System.out.println(stringList);

    }
}
