开发者

MapMaker and ReferenceMap - Google Collections

I understand ReferenceMap from the alpha version of Google Collections has been replaced by MapMaker.

I used this ReferenceMap constructor with the backing map:

public ReferenceMap(ReferenceType keyReferenceType, ReferenceType
       valueReferenceType, ConcurrentMap<Object, Object> backingMap) {
     this(keyReferenceType, valueReferenceType, backingMap, true);
} 

My backing map is a concurrentmap with the ability to collect statistics (hit/miss etc).

开发者_运维百科

What can I use in place of the above ReferenceMap constructor?

Thanks, Grace


We were not able to continue to offer the ability to pass your own backing map. MapMaker works using a customized map implementation of its own.

But, to gather hit/miss statistics, you can wrap the returned ConcurrentMap in a ForwardingConcurrentMap to count get invocations (using an AtomicLong), and have your Function count misses in a similar way. (Hits being, of course, nearly equal to request minus misses.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜