<p>I need a map that has two keys, e.g.</p>

<pre><code>Map2&lt;String /*ssn*/, String /*empId*/, Employee&gt; _employees;
</code></pre>

<p>So that I can</p>

<pre><code>_employees.put(e.ssn(), e.empId(), e)
</code></pre>

<p>And later</p>

<pre><code>_employees.get1(someSsn);
_employees.get2(someImpId);
</code></pre>

<p>Or even</p>

<pre><code>_employees.remove1(someImpId);
</code></pre>

<p>I am not sure why I want to stop at two, why not more, probably because that's the case I am I need right now :-) But the type needs to handle fixed number of keys to be type-safe -- type parameters cannot be vararg :-)</p>

<p>Appreciate any pointers, or advice on why this is a bad idea.</p>

My first thought was: the easiest way to do this, I think, would be two maps.
```
```
Map< String, Map< String,Employee> > _employees;
```
```
But from what it looks like, you just want to be able to look up an employee by either SSN or ID.  What's to stop you then from making two maps, or at worst a class that contains two maps?
As a clarification, are you looking for a
compound key
being employees are uniquely identified by the combination of their SSN and ID, but not either one by itself, or are you looking for two different ways of referencing an employee?