Apache Commons Collections 框架比 JDK 集合框架更快吗?

发布于 2024-08-08 19:34:17 字数 66 浏览 3 评论 0原文

我一直在我的代码中使用库存 JDK 集合。 Apache Commons Collections 框架运行速度更快吗?

I have always been using the stock JDK collections in my code. Does the Apache Commons Collections framework run faster?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

姜生凉生 2024-08-15 19:34:17

不,它并没有更快。而且它不支持泛型。

对于需要 JDK Collections 之外的东西的新项目,我不明白为什么有人会选择 Commons Collections 而不是 Google 馆藏库。

No, it is not faster. And it doesn't support generics.

For a new project that needs something beyond JDK Collections, I can't understand why anyone would choose Commons Collections over the Google Collections Library.

扛刀软妹 2024-08-15 19:34:17

不,它只是更全面、更舒适。

No, it's just more comprehensive and more comfortable.

孤独岁月 2024-08-15 19:34:17

您有点没有抓住重点,因为 Apache Commons Collections 从来就不是 Java Collections 框架的替代品。

就像项目主页上所说的那样:

Commons-Collections 寻求建立在
JDK 类通过提供新的
接口、实现和
公用事业。


不管怎样,就像 erickson 指出的那样,如果您正在使用 Java 集合并希望有一些东西来补充它。至于为什么它应该比Commons Collections更好(埃里克森忘记解决这个问题),请参见这个答案采访中提到。

You're sort of missing the point, because Apache Commons Collections was never meant to be a replacement of the Java Collections framework.

Like it says on the project's home page:

Commons-Collections seek to build upon
the JDK classes
by providing new
interfaces, implementations and
utilities.

Anyway, like erickson pointed out, you're better off with Google Collections if you are using Java collections and want something to complement it. As to why it should be better than Commons Collections (which erickson forgot to address), see e.g. this answer and the interview mentioned in it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文