Apache Commons Collections 框架比 JDK 集合框架更快吗?
我一直在我的代码中使用库存 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,它并没有更快。而且它不支持泛型。
对于需要 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.
不,它只是更全面、更舒适。
No, it's just more comprehensive and more comfortable.
您有点没有抓住重点,因为 Apache Commons Collections 从来就不是 Java Collections 框架的替代品。
就像项目主页上所说的那样:
不管怎样,就像 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:
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.