title: How to create a HashMap with two keys (Key-Pair, Value)?
body: <p>I have a 2D array of Integers. I want them to be put into a HashMap. But I want to access the elements from the HashMap based on Array Index. Something like:</p>
  
  <p>For A[2][5], <code>map.get(2,5)</code> which returns a value associated with that key. But how do I create a hashMap with a pair of keys? Or in general, multiple keys: <code>Map&lt;((key1, key2,..,keyN), Value)</code> in a way that I can access the element with using get(key1,key2,...keyN).</p>
  
  <p><strong>EDIT :  3 years after posting the question, I want to add a bit more to it</strong></p>
  
  <p>I came across another way for <code>NxN matrix</code>. </p>
  
  <p>Array indices, <code>i</code> and <code>j</code> can be represented as a single <code>key</code> the following way:</p>
  
  <pre><code>int key = i * N + j;
  //map.put(key, a[i][j]); // queue.add(key); 
  </code></pre>
  
  <p>And the indices can be retrevied from the <code>key</code> in this way:</p>
  
  <pre><code>int i = key / N;
  int j = key % N;
  </code></pre>