Reputation: 179
We are writing a test framework and we want to maintain a data structure for storing objects at suite level, objects vary from int to slf4j Logger. I am not clear as which data structure to use, which is more effective.
Upvotes: 0
Views: 179
Reputation: 26077
A HashMap
is simpler and faster, is not thread safe. (that is why it is fastest)
Other Caching systems are more sophisticated which means there will be a small overhead. Also will be thread safe.
JCS
support LRU and MRU
, The LRU Memory Cache
is an extremely fast
, highly configurable memory cache
. It uses a Least Recently Used algorithm to manage the number of items that can be stored in memory. The LRU Memory Cache
uses its own LRU Map
implementation that is significantly faster than both the commons LRUMap implementation
and the LinkedHashMap
that is provided with JDK1.4
up.
a good read here
Upvotes: 1