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
Apache Commons Collections has a multikey map which might do the trick for you:
https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/keyvalue/MultiKey.html
It looks like it will handle up to 5 "keys".
I tend to use a list
map.put(Arrays.asList(keyClass, keyString), value)