开发者社区 问答 正文

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

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

展开
收起
vncamyi27xznk 2021-11-13 23:35:19 815 分享 版权
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
    赞同 展开评论
问答分类:
问答地址: