title: Get nested Hashmap values
body: <p>I have this variable :</p>
  
  <pre><code>Hashmap&lt;Integer,HashMap&lt;Integer,Character&gt;&gt; map;
  </code></pre>
  
  <p>I have the first(Integer) and the third element(Character) and I want to get the 2nd Integer with a function. How do i proceed ?
  I know how to get value from a normal Hashmap variable but i don't know how to do it with a nested hashmap...</p>
  
  <p>I have already tried this :</p>
  
  <pre><code>import java.util.*;
  public class Test{
  
    public static void main(String[] args){
  
     HashMap&lt;Integer,HashMap&lt;Integer,Character&gt;&gt; map;
     map = new HashMap&lt;Integer,HashMap&lt;Integer,Character&gt;&gt;();
     map.put(0,new HashMap&lt;Integer,Character&gt;());
     map.get(0).put(7,'c');
  
     System.out.println((map.get(0)).get('c'));
    }
  }
  </code></pre>
  
  <p>I want to print 7 but this print gives me null.</p>
  
  <p><strong>Update</strong> : The best way to solve this problem is to change the structure. HashMap isn't designed to get the index from a value. However, there is a way (look below).</p>