Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Guava Immutable version of LinkedHashMultimap?

I want to create an immutable version of LinkedHashMultiMap. I can roll my own using ImmutableMap and ImmutableList but wondering if there is a way to extend Guava to do it. For example, using Forwarding or Supplier.

like image 708
mjlee Avatar asked Mar 19 '26 07:03

mjlee


1 Answers

It's not clear whether you want a ListMultimap or a SetMultimap, but you almost certainly want ImmutableListMultimap and ImmutableSetMultimap respectively in any event. Like all immutable collections, it'll still preserve insertion order exactly like LinkedHashMultimap.

Guava's immutable collections are very deliberately not extensible.

like image 186
Louis Wasserman Avatar answered Mar 20 '26 22:03

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!