Locate Objects in Collection with multiple keys
<p>Have a class with attributes attr1, attr2, attr3 and attr4.</p>

<p>I am looking for a way to load a bunch of objects of that class in an array (or <code>ArrayList</code> or <code>Map</code> or whatever) and then being able to retrieve (search) these objects based on attr1 or attr2. </p>

<p>It looks like the way to go is <code>HashMap</code> but I will have to: </p>

<ol>
<li><p>if I want only one <code>HashMap</code>, I will have two entries for each object, one with key attr1 and one with key attr2</p></li>
<li><p>have two <code>HashMap</code> objects, one with key attr1 and the other with key attr2 and based on what I am searching for, use the appropriate <code>Map</code>. </p></li>
</ol>

<p>Is there any other elegant way of doing this? Is there a <code>Map</code> or <code>Collection</code> object that will allow me to provide multiple keys for an object?</p>
