title: Parameterize MultiKeyMap with Multiple Keys
body: <p>Is there any way to parameterize Apache Commons' <code>MultiKeyMap</code> with multiple keys? i.e.</p>
  
  <pre><code>MultiKeyMap&lt;String, String, Integer, Float&gt; m = new MultiKeyMap&lt;String, String, Integer, Float&gt;();
  </code></pre>
  
  <p>I originally had raw <code>MultiKeyMaps</code> but because of the frequency of these maps in my program I want to ensure consistency by parameterizing them.</p>
  
  <p>I don't want to use <code>MultiKeys</code> because the data I am storing in the MultiKeyMap requires <code>MultiKey&lt;String, String, Integer&gt;</code>. However, <code>MultiKey</code> only supports keys of one type (<code>MultiKey&lt;String&gt;</code> <em>or</em> <code>MultiKey&lt;Integer&gt;</code>). If there is a workaround to this I am open to suggestions though.</p>
  
  <p>To be clear, the overall problem I want to solve is this: I want to make sure the <code>MultiKeyMaps</code> in my program have the same types of keys by parameterizing them, but with different classes within the key (<code>&lt;K, K, K, V&gt; = &lt;String, String, Integer, Float&gt;</code>).</p>
  
  <p>EDIT: It was suggested (in a now-deleted answer) I use a <code>Triple&lt;String, String, Integer&gt;</code>, and I tried:</p>
  
  <pre><code>private static MultiKeyMap&lt;Triple&lt;String, String, Integer&gt;, Float&gt; multiKeyMap = new MultiKeyMap&lt;Triple&lt;String, String, Integer&gt;, Float&gt;();
  Triple&lt;String, String, Integer&gt; t = Triple.of("asdf", "asdf", 4);
  multiKeyMap.put(t, 5);
  </code></pre>
  
  <p>However, at the third line of this statement it seems to expect something in the form of <code>put(Triple&lt;String, String, Integer&gt; key1, Triple&lt;String, String, Integer&gt; key2, Float value)</code>. My question is now this: With this answer, do I now have no need for a <code>MultiKeyMap</code>? Should I be using a <code>Map&lt;Triple&lt;String, String, Integer&gt;, Float&gt;</code> now?</p>
  
  <p>It is also worth noting that I need to iterate across this map frequently (with a large amount of data), which was easy when I had a non-parameterized <code>MultiKeyMap</code> because I could just change the parameters in the <code>get()</code> method as needed. Using a <code>Triple</code>, I believe I would have to create a new <code>Triple</code> instance each iteration; is this going to resource-heavy or is there a way around this?</p>