I want to store certain objects in a HashMap. The problem is, usually you just use a single object as a key. (You can, for example, use a String.) What I want to do it to us
One can solve this issue using apache's commons collection lib's MultiKey class. Here is a simple example:
import org.apache.commons.collections.keyvalue.MultiKey;
HashMap map = new HashMap();
MultiKey multiKey = new MultiKey(key1, key2);
map.put(multikey,value);
//to get
map.get(new MultiKey(key1,key2));