How to build a ConcurrentLinkedHashmap using Guava?

2k views Asked by At

Several links show that https://code.google.com/p/concurrentlinkedhashmap/ has been ported to Guava, but I can not find the corresponding API in Guava.

Can anybody show me an example to build a ConcurrentLinkedHashmap using Guava ?

Thanks!

1

There are 1 answers

0
Grzegorz Rożniecki On BEST ANSWER

ConcurrentLinkedHashmap API wasn't ported to Guava 1:1, but some solutions from CLHM were used in MapMaker and Cache (with CacheBuilder).

ConcurrentLinkedHashmap's author Ben Manes answers a question which may clarify your doubts: What does it mean that ConcurrentLinkedHashMap has been integrated into Guava?:

Guava is the long term replacement and most of the time you should use it. The history is that ConcurrentLinkedHashMap figured out the algorithms, Guava subsumed it, and then focused on adding features.

I think it's also important to note that he's currently writing another library which may suit your needs:

Caffeine is a Java 8 rewrite of Guava's cache. It tries to provide the best of ConcurrentLinkedHashMap and Guava, modernized with Java 8, and adopting the techniques that I've learned since those previous projects.