title: Searching String Array item in a nested HashMap
body: <p>I have a nested HashMap (<code>outer_map</code>), which has another HashMap inside of it as a value (<code>inner_map</code>), such implemented as</p>
  
  <pre><code>Map&lt;String, HashMap&lt;String, String&gt;&gt; outer_map = new HashMap&lt;String, HashMap&lt;String, String&gt;&gt;();
  Map&lt;String, String&gt; inner_map = new HashMap&lt;String, String&gt;();
  </code></pre>
  
  <p>The figure below illustrates the whole structures of the maps:
  <img src="https://i.stack.imgur.com/UZq2f.png" alt="enter image description here">
  To make the long story short, I need to compare and search values inside the <code>outer_map</code>'s vlaue (<code>inner_map</code>) by <strong><em>String Array</em></strong> items, and then produce another <strong><em>String Array</em></strong> to add matched items.</p>
  
  <blockquote>
    <p>If the <strong><em>String Array</em></strong> has there elements which are the same as one of the <strong><code>inner_map</code></strong>'s random (for example; <strong><code>value2</code></strong>, <strong><code>value1</code></strong>, and <strong><code>value7</code></strong>) values, how can I search and compare these items to add to another <strong><em>String Array</em></strong>?</p>
  </blockquote>
  
  <p>The latest code snippet I tried and I couldn't succeed:</p>
  
  <pre><code>if( !( theStringArray.equals("") ) )
  {
      while( outer_map.keySet().iterator().hasNext() )
      {
         for( int i=0; i &lt;= theStringArray.length; i++) 
         {
             // outer_map keys are order as 1,2,3,..,8
             theStringArray[i] = outer_map.get(String.valueOf(i+1)).get("key1");
             ...
         }
      }
  }
  </code></pre>
  
  <p><strong><code>EDIT</code></strong>: Map generating function</p>
  
  <pre><code>private void parse(String in) throws IOException
  {
      reader = new JsonReader(new StringReader(in));
      ...
      int nodeCounter = 1;
      while(reader.hasNext())
      {    
          ...
              String nameAsKey1 = "blabla"; // value1
              inner_map.put("name", nameAsKey1);
  
              String surnameAsKey2 = "blabla"; // value2
              inner_map.put("surname", surnameAsKey2);
               ...
  
          outer_map.put(String.valueOf(nodeCounter), (HashMap&lt;String, String&gt;) inner_map);
          inner_map = new HashMap&lt;String, String&gt;();
          nodeCounter++;
      }   
  }
  </code></pre>
  
  <p><strong><code>EDIT</code></strong>: I don't know how I can explain the issue more clearly, but may be this will help to understand about it: Map structure </p>
  
  <p><img src="https://i.stack.imgur.com/txERl.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/EGVs6.png" alt="enter image description here"></p>