Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A sorted ComputingMap?

How can I construct a SortedMap on top of Guava's computing map (or vice versa)? I want the sorted map keys as well as computing values on-the-fly.

like image 767
Gili Avatar asked Aug 17 '26 01:08

Gili


1 Answers

The simplest is probably to use a ConcurrentSkipListMap and the memoizer idiom (see JCiP), rather than relying on the pre-built unsorted types from MapMaker. An example that you could use as a basis is a decorator implementation.

like image 190
Ben Manes Avatar answered Aug 18 '26 16:08

Ben Manes



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!