Java Streams API的Javascript等价物 [英] Javascript equivalents for Java Streams API

查看:113
本文介绍了Java Streams API的Javascript等价物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢Java 8的流媒体API。有许多有用的中间和终端方法来转换和收集流。我在谈论中间方法,如 distinct()或终端方法,如 collect()。我发现收集器 API特别有用,可以将流缩减为深度分组映射。

I like the Java 8's streaming API. There are plenty of useful intermediate and terminal methods to transform and collect the stream. I'm talking about intermediate methods like distinct() or terminal methods like collect(). I find the Collector API especially useful, to reduce the stream to deep grouping maps.

什么是javascript等价物对于Java流API?我知道有基本功能,如 map filter reduce ,但是没有找到javascript native提供的任何更通用的接口来查询或分组集合中的数据。是否有一些生产就绪库可以匹配Java Streaming API?

What is the javascript equivalent for the Java streaming API? I know there're basic functions like map, filter and reduce, but don't find any more generalized interfaces provided by javascript native to query or group the data in collection. Are there some production ready libraries to match the Java Streaming API?

推荐答案

java 8 stream()与 lodash chain()

java 8 stream() is the same as lodash chain()

java 8 collect()与 lodash value()

java 8 collect() is the same as lodash value()

java 8 distinct()与 lodash uniq()相同

java 8 distinct() is the same as lodash uniq()

java 8 map()与 lodash map()相同

java 8 map() is the same as lodash map()

lodash更全面,因为它已经存在更长时间了。

lodash is more comprehensive, since it has been around longer.

这篇关于Java Streams API的Javascript等价物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆