文章目录
1. Streams简介
1.1 创建Stream
1.2 Streams多线程
1.3 Stream的基本操作
Matching
Filtering
Mapping
FlatMap
Reduction
Collecting
2. functional interface的分类和使用
2.1 Functional Interface
2.2 Function:一个参数一个返回值
2.3 BiFunction:接收两个参数,一个返回值
2.4 Supplier:无参的Function
2.5 Consumer:接收一个参数,不返回值
2.6 Predicate:接收一个参数,返回boolean
2.7 Operator:接收和返回同样的类型
3. Lambda表达式最佳实践
3.1 优先使用标准Functional接口
3.2 使用@FunctionalInterface注解
3.3 在Functional Interfaces中不要滥用Default Methods
3.4 使用Lambda 表达式来实例化Functional Interface
3.5 不要重写Functional Interface作为参数的方法
3.6 Lambda表达式和内部类是不同的
3.7 Lambda Expression尽可能简洁
3.8 使用方法引用
3.9 Effectively Final 变量
4. stream表达式中实现if/else逻辑
4.1 传统写法
4.2 使用filter
5. 在map中使用stream
5.1 基本概念
5.2 使用Stream获取map的key
5.3 使用stream获取map的value
6. Stream中的操作类型和peek的使用
6.1 中间操作和终止操作
6.2 peek
7. lambda表达式中的异常处理
7.1 处理Unchecked Exception
7.2 处理checked Exception
8. stream中throw Exception
8.1 throw小诀窍
9. stream中Collectors的用法
9.1 Collectors.toList()
9.2 Collectors.toSet()
9.3 Collectors.toCollection()
9.4 Collectors.toMap()
9.5 Collectors.collectingAndThen()
9.6 Collectors.joining()
9.7 Collectors.counting()
9.8 Collectors.summarizingDouble/Long/Int()
9.9 Collectors.averagingDouble/Long/Int()
9.10 Collectors.summingDouble/Long/Int()
9.11 Collectors.maxBy()/minBy()
9.12 Collectors.groupingBy()
9.13 Collectors.partitioningBy()
10. 创建一个自定义的collector
10.1 Collector介绍
10.2 自定义Collector
11. stream reduce详解和误区
11.1 reduce详解
12. stream中的Spliterator
12.1 tryAdvance
12.2 trySplit
12.3 estimateSize
12.4 characteristics
12.5 举个例子
13. break stream的foreach
13.1 使用Spliterator
13.2 自定义forEach方法
14. predicate chain的使用
14.1 基本使用
14.2 使用多个Filter
14.3 使用复合Predicate
14.4 组合Predicate
14.5 Predicate的集合操作
15. 中构建无限的stream
15.1 基本使用
15.2 自定义类型
16. 自定义parallelStream的thread pool
16.1 通常操作
16.2 使用自定义ForkJoinPool
17. 总结
文章目录
1. Streams简介
1.1 创建Stream
1.2 Streams多线程
1.3