3

From here, I found that Colt's OpenIntIntHashMap and Trove's TIntIntHashMap give better performance and memory uses than Java's built in HashMap or Guava's HashMultimap.

Do Colt's OpenIntIntHashMap or Trove's TIntIntHashMap allow keys with multiple values, as with HashMultimap? If not what is a nice way to implement a HashMultimap that can achieve Colt's or Trove's performance and memory efficiency?

Note: I have tested Guava's HashMultimap, but its performance and memory efficiency seems poor to me.

1 Answer 1

5
Multimaps.newSetMultimap(
  TDecorators.wrap(new TIntObjectHashMap<Collection<Integer>>()),
  new Supplier<Set<Integer>>() {
    public Set<Integer> get() {
      return TDecorators.wrap(new TIntHashSet());
    }
  });
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks. But, for using this structure what should I have to do ? Means, is Trove has any .jar file ?
If you go to the Trove website and go to the "Downloads" section it's pretty straightforward.
Thanks. Actually, I download trove from sourceforge.net/projects/trove4j/files/trove/3.0.1. However, when I add trove.jar file in my class path, it gives error that gnu.trove.set.hash.TIntHashSet (and others) are not found. Can you kindly help me, how to use Trove.
The trove-3.0.1.jar file is in the lib folder of the zip file. If adding that to your classpath doesn't help, I can't help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.