Java8新特性(四)————— Stream API

关注微信公众号【行走在代码行的寻路人】获取Java相关资料,分享项目经验及知识干货。

  • 了解 Stream

Java8中有两大最为重要的改变。第一个是 Lambda 表达式;另外一 个则是 Stream API(java.util.stream.*)
Stream 是 Java8 中处理集合的关键抽象概念,它可以指定你希望对集合进行的操作,可以执行非常复杂的查找、过滤和映射数据等操作。使用Stream API 对集合数据进行操作,就类似于使用 SQL 执行的数据库查询。也可以使用 Stream API 来并行执行操作。简而言之, Stream API 提供了一种高效且易于使用的处理数据的方式。
  • 什么是 Stream

流(Stream) 到底是什么呢?
是数据渠道,用于操作数据源(集合、数组等)所生成的元素序列。
“集合讲的是数据,流讲的是计算!”
注意:
①Stream 自己不会存储元素。
②Stream 不会改变源对象。相反,他们会返回一个持有结果的新Stream。
③Stream 操作是延迟执行的。这意味着他们会等到需要结果的时候才执行。
  • Stream 的操作三个步骤

  • 创建 Stream
Java8 中的 Collection 接口被扩展,提供了
两个获取流的方法
  1. default Stream<E> stream() : 返回一个顺序流
  2. default Stream<E> parallelStream() : 返回一个并行流

   一个数据源(如:集合、数组),获取一个流

String[] str = new String[]{"aaa","bbb","ccc"};
Stream stream = Arrays.stream(str);
        
List<String> list = new ArrayList<String>();
Stream stream = list.stream();
  • 中间操作
   一个中间操作链,对数据源的数据进行处理
  注:对集合数据、对数组进行过滤、比较等等类似SQL查询过滤
 
  •  终止操作(终端操作)
   一个终止操作,执行中间操作链,并产生结果
  注:中间操作后进行输出最后的结果
 
  • Stream创建流

Java8 中的 Collection 接口被扩展,提供了 两个获取流的方法:
  1. default Stream<E> stream() : 返回一个顺序流
  2. default Stream<E> parallelStream() : 返回一个并行流
Java8 中的 Arrays 的静态方法 stream() 可 以获取数组流:
  1. static <T> Stream<T> stream(T[] array): 返回一个流
  2. public static IntStream stream(int[] array) :重载形式,能够处理对应基本类型的数组
  3. public static LongStream stream(long[] array):重载形式,能够处理对应基本类型的数组
  4. public static DoubleStream stream(double[] array):重载形式,能够处理对应基本类型的数组
可以使用静态方法 Stream.of(), 通过显示值 创建一个流。它可以接收任意数量的参数。
  1. public static<T> Stream<T> of(T... values) : 返回一个流
可以使用静态方法 Stream.iterate() 和 Stream.generate(), 创建无限流。
  1. public static<T> Stream<T> iterate(final T seed, final UnaryOperator<T> f):迭代
  2. public static<T> Stream<T> generate(Supplier<T> s) :生成
  • Stream中间操作

多个中间操作可以连接起来形成一个流水线,除非流水 线上触发终止操作,否则中间操作不会执行任何的处理! 而在终止操作时一次性全部处理,称为“惰性求值”

  • 筛选与切片

案例:

/*
 * 一、Stream API 的操作步骤:
 *
 * 1. 创建 Stream
 *
 * 2. 中间操作
 *
 * 3. 终止操作(终端操作)
 */
public class StreamaAPITest {

    List<Employee> emps = Arrays.asList(
            new Employee(102, "李四", 59, 6666.66),
            new Employee(101, "张三", 18, 9999.99),
            new Employee(103, "王五", 28, 3333.33),
            new Employee(104, "赵六", 8, 7777.77),
            new Employee(104, "赵六", 8, 7777.77),
            new Employee(104, "赵六", 8, 7777.77),
            new Employee(105, "田七", 38, 5555.55)
    );

   /**
    *筛选与切片
    *filter——接收 Lambda , 从流中排除某些元素。
    *limit——截断流,使其元素不超过给定数量。
    *skip(n) —— 跳过元素,返回一个扔掉了前 n 个元素的流。若流中元素不足 n 个,则返回一个空流。    与 limit(n) 互补
    *distinct——筛选,通过流所生成元素的 hashCode() 和 equals() 去除重复元素
	**/
    @Test
    public void test1(){
        //filter:过滤age大于30的人员信息
        emps.stream().filter((e) -> e.getAge()>30).forEach(System.out::println);
        System.out.println("======================================================");
        //distinct 去重
        emps.stream().distinct().forEach(System.out::println);
        System.out.println("======================================================");
        //limit 获取前两个
        emps.stream().filter(e -> e.getSalary()>4500).limit(1).forEach(System.out::println);
        System.out.println("======================================================");
        //skip 跳过前两条数据
        emps.stream().filter(e -> e.getSalary()>5000).skip(2).forEach(System.out::println);
    }

}
  • 映射

案例:

    /**
     * map——接收 Lambda , 将元素转换成其他形式或提取信息。
     *      接收一个函数作为参数,该函数会被应用到每个元素上,并将其映射成一个新的元素。
     * flatMap——接收一个函数作为参数,将流中的每个值都换成另一个流,然后把所有流连接成一个流
     */
    @Test
    public void test2(){
        List<String> strList = Arrays.asList("aaa", "bbb", "ccc", "ddd", "eee");
        strList.stream().map(String::toUpperCase).forEach(System.out::println);

        System.out.println("===================================================");
        strList.stream().flatMap(StreamaAPITest::filterCharacter).forEach(System.out::print);
    }

    public static Stream<Character> filterCharacter(String str){
        List<Character> list = new ArrayList<>();
        for (Character ch : str.toCharArray()) {
            list.add(ch);
        }
        return list.stream();
    }
  • 排序

案例:

List<Employee> emps = Arrays.asList(
            new Employee(102, "李四", 59, 6666.66),
            new Employee(101, "张三", 18, 9999.99),
            new Employee(103, "王五", 28, 3333.33),
            new Employee(103, "王五五", 28, 8888.88),
            new Employee(104, "赵六", 8, 7777.77),
            new Employee(104, "赵六", 8, 7777.77),
            new Employee(104, "赵六", 8, 7777.77),
            new Employee(105, "田七", 38, 5555.55)
    );

    /**
     * sorted()——自然排序
     * sorted(Comparator com)——定制排序
     */
    @Test
    public void test3(){
        //按年龄排序
        emps.stream().map(Employee::getAge).sorted().forEach(System.out::println);
        System.out.println("====================================================");
        //按年龄排序后按工资排序
        emps.stream().sorted((x,y) -> {
            if(x.getAge()==y.getAge()){
                return Double.compare(x.getSalary(),y.getSalary());
            }else{
                return Integer.compare(x.getAge(),y.getAge());
            }
        }).forEach(System.out::println);

    }
  • 查找与匹配

案例:

List<Employee> emps = Arrays.asList(
            new Employee(102, "李四", 59, 6666.66, Employee.Status.BUSY),
            new Employee(101, "张三", 18, 9999.99, Employee.Status.FREE),
            new Employee(103, "王五", 28, 3333.33, Employee.Status.VOCATION),
            new Employee(104, "赵六", 8, 7777.77, Employee.Status.BUSY),
            new Employee(104, "赵六", 8, 7777.77, Employee.Status.BUSY),
            new Employee(104, "赵六", 8, 7777.77, Employee.Status.BUSY),
            new Employee(105, "田七", 38, 5555.55, Employee.Status.BUSY)
    );

    /**
     *
     * 		allMatch——检查是否匹配所有元素
     * 		anyMatch——检查是否至少匹配一个元素
     * 		noneMatch——检查是否没有匹配的元素
     * 		findFirst——返回第一个元素
     * 		findAny——返回当前流中的任意元素
     * 		count——返回流中元素的总个数
     * 		max——返回流中最大值
     * 		min——返回流中最小值
     *
     */
    @Test
    public void test4(){
        //allMatch 是否所有人员的状态都是忙碌
        boolean b = emps.stream().allMatch(e -> e.getStatus().equals(Employee.Status.BUSY));
        System.out.println(b);
        System.out.println("====================================================");
        //anyMatch 是否存在忙碌的人员
        boolean b1 = emps.stream().anyMatch(e -> e.getStatus().equals(Employee.Status.BUSY));
        System.out.println(b1);
        System.out.println("====================================================");
        //noneMatch 没有忙碌的人员
        boolean b2 = emps.stream().noneMatch(e -> e.getStatus().equals(Employee.Status.BUSY));
        System.out.println(b2);
        System.out.println("====================================================");
        //findFirst 获取第一个人员信息
        Optional<Employee> first = emps.stream().filter(e -> e.getAge() < 30).findFirst();
        System.out.println(first.get());
        System.out.println("====================================================");
        //findAny 返回任意一个元素,默认为顺序流因此按照第一个输出
        Optional<Employee> any = emps.stream().filter(e -> e.getSalary() >5000).findAny();
        System.out.println(any.get());
        System.out.println("====================================================");
        //并行流
        Optional<Employee> any1 = emps.parallelStream().filter(e -> e.getSalary() >5000).findAny();
        System.out.println(any1.get());
        System.out.println("====================================================");
        //count 总数
        long count = emps.stream().count();
        System.out.println(count);
        System.out.println("====================================================");
        //max 年龄最大的员工信息
        Optional<Employee> max = emps.stream().max((x,y) -> Integer.compare(x.getAge(),y.getAge()));
        System.out.println(max.get());
        System.out.println("====================================================");
        //min 工资最少是多少
        Optional<Double> min = emps.stream().map(Employee::getSalary).min(Double::compareTo);
        System.out.println(min.get());
        System.out.println("====================================================");
    }
  • 归约

案例:

    List<Employee> emps = Arrays.asList(
            new Employee(102, "李四", 59, 6666.66, Employee.Status.BUSY),
            new Employee(101, "张三", 18, 9999.99, Employee.Status.FREE),
            new Employee(103, "王五", 28, 3333.33, Employee.Status.VOCATION),
            new Employee(104, "赵六", 8, 7777.77, Employee.Status.BUSY),
            new Employee(104, "赵六", 8, 7777.77, Employee.Status.BUSY),
            new Employee(104, "赵六", 8, 7777.77, Employee.Status.BUSY),
            new Employee(105, "田七", 38, 5555.55, Employee.Status.BUSY)
    );

    /**
     * reduce(T identity, BinaryOperator) / reduce(BinaryOperator) ——可以将流中元素反复结合起来,得到一个值。
     */
    @Test
    public void test5(){
        //所有工资总和
        Optional<Double> reduce = emps.stream().map(Employee::getSalary).reduce(Double::sum);
        System.out.println(reduce.get());
        System.out.println("====================================================");
        //名字出现六的次数
        Optional<Integer> reduce1 = emps.stream().map(Employee::getName).flatMap(StreamaAPITest::filterCharacter)
                .map((ch) -> {
                    if (ch.equals('六')) {
                        return 1;
                    } else {
                        return 0;
                    }
                }).reduce(Integer::sum);
        System.out.println(reduce1.get());
        System.out.println("====================================================");
    }
  • 收集  

  •         注:Collector 接口中方法的实现决定了如何对流执行收集操作(如收 集到 List、Set、Map)。但是 Collectors 实用类提供了很多静态 方法,可以方便地创建常见收集器实例,具体方法与实例如下表:

案例:

List<Employee> emps = Arrays.asList(
            new Employee(102, "李四", 59, 6666.66, Employee.Status.BUSY),
            new Employee(101, "张三", 18, 9999.99, Employee.Status.FREE),
            new Employee(103, "王五", 28, 3333.33, Employee.Status.VOCATION),
            new Employee(104, "赵六", 8, 7777.77, Employee.Status.BUSY),
            new Employee(104, "赵六", 8, 7777.77, Employee.Status.BUSY),
            new Employee(104, "赵六", 8, 7777.77, Employee.Status.BUSY),
            new Employee(105, "田七", 38, 5555.55, Employee.Status.BUSY)
    );

    /**
     * collect——将流转换为其他形式。接收一个 Collector接口的实现,用于给Stream中元素做汇总的方法
     */
    @Test
    public void test6(){
        //toList 将所有名字封转成list
        emps.stream().map(Employee::getName).collect(Collectors.toList()).forEach(System.out::println);
        System.out.println("====================================================");
        //toSet 将所有名字封转成Set
        emps.stream().map(Employee::getName).collect(Collectors.toSet()).forEach(System.out::println);
        System.out.println("====================================================");
        //joining 获取姓名用,分割
        String join = emps.stream().map(Employee::getName).collect(Collectors.joining(","));
        System.out.println(join);
        System.out.println("====================================================");
        //maxBy 获取工资最大的
        Optional<Double> collect = emps.stream().map(Employee::getSalary).collect(Collectors.maxBy(Double::compareTo));
        System.out.println(collect.get());
        System.out.println("====================================================");
        //maxBy 工资最大的员工信息
        Optional<Employee> collect1 = emps.stream().collect(Collectors.maxBy((x, y) -> Double.compare(x.getSalary(), y.getSalary())));
        System.out.println(collect1.get());
        System.out.println("====================================================");
        //summingDouble 获取工资总和
        Double sum = emps.stream().collect(Collectors.summingDouble(Employee::getSalary));
        System.out.println(sum);
        System.out.println("====================================================");
        //averagingDouble 获取平均年龄
        Double collect2 = emps.stream().collect(Collectors.averagingDouble(Employee::getAge));
        System.out.println(collect2);
        System.out.println("====================================================");
        //groupingBy 根据状态分组
        Map<Employee.Status, List<Employee>> collect3 = emps.stream().collect(Collectors.groupingBy(Employee::getStatus));
        System.out.println(collect3);
        System.out.println("====================================================");
        //groupingBy 多级分组,先状态分组 然后按年龄分组
        Map<Employee.Status, Map<String, List<Employee>>> map = emps.stream()
                .collect(Collectors.groupingBy(Employee::getStatus, Collectors.groupingBy((e) -> {
                    if(e.getAge() >= 60) {
                        return "老年";
                    }else if(e.getAge() >= 35) {
                        return "中年";
                    }else {
                        return "成年";
                    }
                })));
        System.out.println(map);
        System.out.println("====================================================");
    }

全部代码:

package com.company.test;

import org.junit.Test;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/*
 * 一、Stream API 的操作步骤:
 *
 * 1. 创建 Stream
 *
 * 2. 中间操作
 *
 * 3. 终止操作(终端操作)
 */
public class StreamaAPITest {

    List<Employee> emps = Arrays.asList(
            new Employee(102, "李四", 59, 6666.66, Employee.Status.BUSY),
            new Employee(101, "张三", 18, 9999.99, Employee.Status.FREE),
            new Employee(103, "王五", 28, 3333.33, Employee.Status.VOCATION),
            new Employee(104, "赵六", 8, 7777.77, Employee.Status.BUSY),
            new Employee(104, "赵六", 8, 7777.77, Employee.Status.BUSY),
            new Employee(104, "赵六", 8, 7777.77, Employee.Status.BUSY),
            new Employee(105, "田七", 38, 5555.55, Employee.Status.BUSY)
    );

    /**
     * collect——将流转换为其他形式。接收一个 Collector接口的实现,用于给Stream中元素做汇总的方法
     */
    @Test
    public void test6(){
        //toList 将所有名字封转成list
        emps.stream().map(Employee::getName).collect(Collectors.toList()).forEach(System.out::println);
        System.out.println("====================================================");
        //toSet 将所有名字封转成Set
        emps.stream().map(Employee::getName).collect(Collectors.toSet()).forEach(System.out::println);
        System.out.println("====================================================");
        //joining 获取姓名用,分割
        String join = emps.stream().map(Employee::getName).collect(Collectors.joining(","));
        System.out.println(join);
        System.out.println("====================================================");
        //maxBy 获取工资最大的
        Optional<Double> collect = emps.stream().map(Employee::getSalary).collect(Collectors.maxBy(Double::compareTo));
        System.out.println(collect.get());
        System.out.println("====================================================");
        //maxBy 工资最大的员工信息
        Optional<Employee> collect1 = emps.stream().collect(Collectors.maxBy((x, y) -> Double.compare(x.getSalary(), y.getSalary())));
        System.out.println(collect1.get());
        System.out.println("====================================================");
        //summingDouble 获取工资总和
        Double sum = emps.stream().collect(Collectors.summingDouble(Employee::getSalary));
        System.out.println(sum);
        System.out.println("====================================================");
        //averagingDouble 获取平均年龄
        Double collect2 = emps.stream().collect(Collectors.averagingDouble(Employee::getAge));
        System.out.println(collect2);
        System.out.println("====================================================");
        //groupingBy 根据状态分组
        Map<Employee.Status, List<Employee>> collect3 = emps.stream().collect(Collectors.groupingBy(Employee::getStatus));
        System.out.println(collect3);
        System.out.println("====================================================");
        //groupingBy 多级分组,先状态分组 然后按年龄分组
        Map<Employee.Status, Map<String, List<Employee>>> map = emps.stream()
                .collect(Collectors.groupingBy(Employee::getStatus, Collectors.groupingBy((e) -> {
                    if(e.getAge() >= 60) {
                        return "老年";
                    }else if(e.getAge() >= 35) {
                        return "中年";
                    }else {
                        return "成年";
                    }
                })));
        System.out.println(map);
        System.out.println("====================================================");
    }

    /**
     * reduce(T identity, BinaryOperator) / reduce(BinaryOperator) ——可以将流中元素反复结合起来,得到一个值。
     */
    @Test
    public void test5(){
        //所有工资总和
        Optional<Double> reduce = emps.stream().map(Employee::getSalary).reduce(Double::sum);
        System.out.println(reduce.get());
        System.out.println("====================================================");
        //名字出现六的次数
        Optional<Integer> reduce1 = emps.stream().map(Employee::getName).flatMap(StreamaAPITest::filterCharacter)
                .map((ch) -> {
                    if (ch.equals('六')) {
                        return 1;
                    } else {
                        return 0;
                    }
                }).reduce(Integer::sum);
        System.out.println(reduce1.get());
        System.out.println("====================================================");
    }

    public static Stream<Character> filterCharacter(String str){
        List<Character> list = new ArrayList<>();
        for (Character ch : str.toCharArray()) {
            list.add(ch);
        }
        return list.stream();
    }

    /**
     *
     * 		allMatch——检查是否匹配所有元素
     * 		anyMatch——检查是否至少匹配一个元素
     * 		noneMatch——检查是否没有匹配的元素
     * 		findFirst——返回第一个元素
     * 		findAny——返回当前流中的任意元素
     * 		count——返回流中元素的总个数
     * 		max——返回流中最大值
     * 		min——返回流中最小值
     *
     */
    @Test
    public void test4(){
        //allMatch 是否所有人员的状态都是忙碌
        boolean b = emps.stream().allMatch(e -> e.getStatus().equals(Employee.Status.BUSY));
        System.out.println(b);
        System.out.println("====================================================");
        //anyMatch 是否存在忙碌的人员
        boolean b1 = emps.stream().anyMatch(e -> e.getStatus().equals(Employee.Status.BUSY));
        System.out.println(b1);
        System.out.println("====================================================");
        //noneMatch 没有忙碌的人员
        boolean b2 = emps.stream().noneMatch(e -> e.getStatus().equals(Employee.Status.BUSY));
        System.out.println(b2);
        System.out.println("====================================================");
        //findFirst 获取第一个人员信息
        Optional<Employee> first = emps.stream().filter(e -> e.getAge() < 30).findFirst();
        System.out.println(first.get());
        System.out.println("====================================================");
        //findAny 返回任意一个元素,默认为顺序流因此按照第一个输出
        Optional<Employee> any = emps.stream().filter(e -> e.getSalary() >5000).findAny();
        System.out.println(any.get());
        System.out.println("====================================================");
        //并行流
        Optional<Employee> any1 = emps.parallelStream().filter(e -> e.getSalary() >5000).findAny();
        System.out.println(any1.get());
        System.out.println("====================================================");
        //count 总数
        long count = emps.stream().count();
        System.out.println(count);
        System.out.println("====================================================");
        //max 年龄最大的员工信息
        Optional<Employee> max = emps.stream().max((x,y) -> Integer.compare(x.getAge(),y.getAge()));
        System.out.println(max.get());
        System.out.println("====================================================");
        //min 工资最少是多少
        Optional<Double> min = emps.stream().map(Employee::getSalary).min(Double::compareTo);
        System.out.println(min.get());
        System.out.println("====================================================");
    }

    /**
     * sorted()——自然排序
     * sorted(Comparator com)——定制排序
     */
    @Test
    public void test3(){
        //按年龄排序
        emps.stream().map(Employee::getAge).sorted().forEach(System.out::println);
        System.out.println("====================================================");
        //按年龄排序后按工资排序
        emps.stream().sorted((x,y) -> {
            if(x.getAge()==y.getAge()){
                return Double.compare(x.getSalary(),y.getSalary());
            }else{
                return Integer.compare(x.getAge(),y.getAge());
            }
        }).forEach(System.out::println);

    }

    /**
     * map——接收 Lambda , 将元素转换成其他形式或提取信息。
     *      接收一个函数作为参数,该函数会被应用到每个元素上,并将其映射成一个新的元素。
     * flatMap——接收一个函数作为参数,将流中的每个值都换成另一个流,然后把所有流连接成一个流
     */
    @Test
    public void test2(){
        List<String> strList = Arrays.asList("aaa", "bbb", "ccc", "ddd", "eee");
        strList.stream().map(String::toUpperCase).forEach(System.out::println);

        System.out.println("===================================================");
        strList.stream().flatMap(StreamaAPITest::filterCharacter).forEach(System.out::print);
    }


   /**
    *筛选与切片
    *filter——接收 Lambda , 从流中排除某些元素。
    *limit——截断流,使其元素不超过给定数量。
    *skip(n) —— 跳过元素,返回一个扔掉了前 n 个元素的流。若流中元素不足 n 个,则返回一个空流。与 limit(n) 互补
    *distinct——筛选,通过流所生成元素的 hashCode() 和 equals() 去除重复元素
	**/
    @Test
    public void test1(){
        //filter:过滤age大于30的人员信息
        emps.stream().filter((e) -> e.getAge()>30).forEach(System.out::println);
        System.out.println("======================================================");
        //distinct 去重
        emps.stream().distinct().forEach(System.out::println);
        System.out.println("======================================================");
        //limit 获取前两个
        emps.stream().filter(e -> e.getSalary()>4500).limit(1).forEach(System.out::println);
        System.out.println("======================================================");
        //skip 跳过前两条数据
        emps.stream().filter(e -> e.getSalary()>5000).skip(2).forEach(System.out::println);
    }

}
package com.company.test;

public class Employee {

	private int id;
	private String name;
	private int age;
	private double salary;
	private Status status;

	public Employee() {
	}

	public Employee(String name) {
		this.name = name;
	}

	public Employee(String name, int age) {
		this.name = name;
		this.age = age;
	}

	public Employee(int id, String name, int age, double salary) {
		this.id = id;
		this.name = name;
		this.age = age;
		this.salary = salary;
	}

	public Employee(int id, String name, int age, double salary, Status status) {
		this.id = id;
		this.name = name;
		this.age = age;
		this.salary = salary;
		this.status = status;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public double getSalary() {
		return salary;
	}

	public void setSalary(double salary) {
		this.salary = salary;
	}

	public String show() {
		return "测试方法引用!";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + age;
		result = prime * result + id;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		long temp;
		temp = Double.doubleToLongBits(salary);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Employee other = (Employee) obj;
		if (age != other.age)
			return false;
		if (id != other.id)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (Double.doubleToLongBits(salary) != Double.doubleToLongBits(other.salary))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Employee [id=" + id + ", name=" + name + ", age=" + age + ", salary=" + salary + ", status=" + status
				+ "]";
	}

	public enum Status {
		FREE, BUSY, VOCATION;
	}
}
发布了101 篇原创文章 · 获赞 10 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/WMY1230/article/details/102925771