I'm trying to simulate a directly mapped cache in java. Any ideas on which data structure to use to represent the cache?
views:
53answers:
2
+1
A:
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);
duffymo
2010-05-05 01:26:53
A:
It sounds like you're talking about hardware caching. Would a Map<Long, Byte[]>
work?
Matt Ball
2010-05-05 01:27:38