什么是最有效的Java Collections库? [英] What is the most efficient Java Collections library?

查看:112
本文介绍了什么是最有效的Java Collections库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是最有效的Java Collections库?

What is the most efficient Java Collections library?

几年前,我做了很多Java, http://trove4j.sourceforge.net/rel =nofollow noreferrer> trove 是最好的(最高效的)Java Collections实现。但是当我阅读问题最有用的免费Java库?的答案时,注意到 trove 几乎没有提及。那么哪些Java Collections库最好呢?

A few years ago, I did a lot of Java and had the impression back then that trove is the best (most efficient) Java Collections implementation. But when I read the answers to the question "Most useful free Java libraries?" I noticed that trove is hardly mentioned. So which Java Collections library is best now?

UPDATE:为了说明,当我必须在哈希表中存储数百万个条目时,我主要想知道要使用什么库。 (需要一个小的运行时和内存占用)。

UPDATE: To clarify, I mostly want to know what library to use when I have to store millions of entries in a hash table etc. (need a small runtime and memory footprint).

推荐答案

看起来Trove只是一个原始库类型 - 这不是想在JDK的正常集合中添加很多功能。

From inspection, it looks like Trove is just a library of collections for primitive types - it's not like it's meant to be adding a lot of functionality over the normal collections in the JDK.

个人(我有偏见)我喜欢 Guava (包括前Google Java Collections集合项目)。它使各种任务(包括集合)更容易,在一种至少相当有效的方式。鉴于收集操作很少在我的代码中形成瓶颈(根据我的经验),这比收集API更好,但可能更有效,但不能使我的代码可读。

Personally (and I'm biased) I love Guava (including the former Google Java Collections project). It makes various tasks (including collections) a lot easier, in a way which is at least reasonably efficient. Given that collection operations rarely form a bottleneck in my code (in my experience) this is "better" than a collections API which may be more efficient but doesn't make my code as readable.

由于Trove和Guava之间的重叠几乎为零,因此您可以从集合库中找出您实际需要的内容。

Given that the overlap between Trove and the Guava is pretty much nil, perhaps you could clarify what you're actually looking for from a collections library.

这篇关于什么是最有效的Java Collections库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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