本文介绍了有没有可行的通用替代apache.commons.collections.CollectionUtils?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个可行的 org.apache.commons.collections.CollectionUtils 的通用版本?如果不是,为什么不呢?这似乎是一个明显的需要。或者有Java社区刚刚放弃了函数编码,直到闭包被添加到Java 17?

Is there a viable generic version of org.apache.commons.collections.CollectionUtils? If not, why not? It seems like an obvious need. Or has the Java community just given up on functional coding until closures are added to Java 17?

推荐答案

稍微过时的Commons Collections 。

There's a genericified port of a slightly out-of-date version of Commons Collections here. It's no longer maintained, however.

更好的选择是。它有类 Lists Sets Collections2 等是相当于Commons的 CollectionUtils 。 Guava不是Commons Collections的一对一端口,但它有一个更好的设计和更一致的API。如果你习惯于Commons Collections,需要稍作调整。

A better option is Google Guava. It has classes like Lists, Sets, Collections2 etc that are the equivalent to Commons' CollectionUtils. Guava is not a one-for-one port of Commons Collections, but it has a better designed and more consistent API. Takes a bit of adjusting to, if you're used to Commons Collections.

这篇关于有没有可行的通用替代apache.commons.collections.CollectionUtils?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 10:18