StreamEx

2022-08-21 14:43:55 浏览数 (1)

跟昨天介绍的eclipse-collections一样,这是一个同类产品:

仓库地址:https://github.com/amaembo/streamex

JavaDoc:http://amaembo.github.io/streamex/javadoc/one/util/streamex/package-summary.html

感受下:

代码语言:javascript复制
List<String> userNames = StreamEx.of(users).map(User::getName).toList();
Map<Role, List<User>> role2users = StreamEx.of(users).groupingBy(User::getRole);
StreamEx.of(1,2,3).joining("; "); // "1; 2; 3"

对比起来好像比eclipse-collections写更少代码

而且更向原生stream靠拢

文档:https://github.com/amaembo/streamex/blob/master/wiki/CHEATSHEET.md

0 人点赞