3- Stream流-List
Stream编程
可简化代码,优化性能
- demo1
集合元素进行过滤 以J开头的元素且长度为4,存储到新的元素中,然后输出

结果
res = [Jack, JMas]
Process finished with exit code 0
Stream写法

结果
collect = [Jack, JMas]
Process finished with exit code 0
可简化代码,优化性能
集合元素进行过滤 以J开头的元素且长度为4,存储到新的元素中,然后输出

结果
res = [Jack, JMas]
Process finished with exit code 0
Stream写法

结果
collect = [Jack, JMas]
Process finished with exit code 0