Collectors.toList():转换成List集合。/ Collectors.toSet():转换成set集合。
System.out.println(Stream.of("a", "b", "c", "a").collect(Collectors.toSet()));
List<Field> fields = Stream.of(cls.getDeclaredFields()).collect(Collectors.toList());
Collectors.toCollection(TreeSet::new):转换成特定的set集合。
TreeSet<String> treeSet = Stream.of("a", "c", "b", "a").collect(Collectors.toCollection(TreeSet::new));
System.out.println(treeSet);
Collectors.toMap(keyMapper, valueMapper, mergeFunction):转换成map。
Map<String, String> collect = Stream.of("a", "b", "c", "a").collect(Collectors.toMap(x -> x, x -> x + x,(oldVal, newVal) -> newVal)));
collect.forEach((k,v) -> System.out.println(k + ":" + v));