Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Hash Multi Map (key with multiple values) Implementation

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.

like image 656
Arpssss Avatar asked Aug 03 '26 06:08

Arpssss


1 Answers

Multimaps.newSetMultimap(
  TDecorators.wrap(new TIntObjectHashMap<Collection<Integer>>()),
  new Supplier<Set<Integer>>() {
    public Set<Integer> get() {
      return TDecorators.wrap(new TIntHashSet());
    }
  });
like image 184
Louis Wasserman Avatar answered Aug 05 '26 18:08

Louis Wasserman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!