开发者社区> 问答> 正文

JAVA中 Stream 先后通过 filter、map、 sort、limit 以及 distin

JAVA中 Stream 先后通过 filter、map、 sort、limit 以及 distinct 处理后会发生什么?

展开
收起
vncamyi27xznk 2021-11-13 23:35:19 678 0
1 条回答
写回答
取消 提交回答
  • "console.log(List strings = Arrays.asList(""Hollis"", ""HollisChuang"", ""hollis"", ""H ello"", ""HelloWorld"", ""Hollis""); Stream s = strings.stream().filter(string -> string.length()<= 6).map(Strin g::length).sorted().limit(3) .distinct();) 过程及每一步得到的结果如下图: image.png

    资料来源:《Java工程师成神之路(基础篇)》,链接:https://developer.aliyun.com/topic/download?id=923"

    2021-11-16 13:25:42
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载