I'm trying to simulate a directly mapped cache in java. Any ideas on which data structure to use to represent the cache?
I'm trying to simulate a directly mapped cache in java. Any ideas on which data structure to开发者_C百科 use to represent the cache?
Try a Map interface for the reference type and WeakHashMap as the implementation:
int initialCapacity = 1024;
Map<K, V> cache = new WeakHashMap<K, V>(initialCapacity);
精彩评论