Have a class with attributes attr1, attr2, attr3 and attr4.
I am looking for a way to load a bunch of objects of that class in an array (or ArrayList or Map or whatever) and then being able to retrieve (search) these objects based on attr1 or attr2.
It looks like the way to go is HashMap but I will have to:
if I want only one
HashMap, I will have two entries for each object, one with key attr1 and one with key attr2have two
HashMapobjects, one with key attr1 and the other with key attr2 and based on what I am searching for, use the appropriateMap.
Is there any other elegant way of doing this? Is there a Map or Collection object that will allow me to provide multiple keys for an object?