I need to implement a MultiKeyMap, where I can have 2 keys and a value. I was looking to Apache collections MultiKeyMap, but I’m not sure if it is the best one. My problem is that I need to use this MultiKeyMap in a Web environment, and the Apache implementation is not thread safe (and Collections.synchronizedMap(..) doesn’t work).
Any idea?
Thanks!
Yeah, as andrew007 suggests, you can use MultiKey. If I were you though, I will implement my own class, name it something like BiKey, or even something more meaningful. One of the reason is that MultiKey is not generified.
To summarize, why don’t you do something like:
ConcurrentHashMap scales really nice, and it has some useful operations that can come in handy.