title: Get a String from a Map inside Map Java 8
body: <p>What do you think is the best way to find a value in a map inside another map.</p>
  
  <pre><code>    Map &lt;String, String&gt; map1 = new HashMap&lt;&gt;();
  
      map1.put("map1|1", "1.1");
      map1.put("map1|2", "1.2");
      map1.put("map1|3", "1.3");
      map1.put("map1|4", "1.4");
  
      Map &lt;String, String&gt; map2 = new HashMap&lt;&gt;();
  
      map2.put("map2|1", "2.1");
      map2.put("map2|2", "2.2");
      map2.put("map2|3", "2.3");
      map2.put("map2|4", "2.4");
  
  
      Map&lt;String, Map&gt; mapOfMaps = new HashMap&lt;&gt;();
  
      mapOfMaps.put("MAP|map1", map1);
      mapOfMaps.put("MAP|map2", map2);
  </code></pre>
  
  <p>Now if I need the value of "MAP|map2" (inside mapOfMaps) and "map2|3" (inside map2) will be "2.3"</p>
  
  <p>I tried to do something like:</p>
  
  <pre><code>System.out.println("x="+getValue(mapOfMaps,"MAP|map2", "map2|4"));
  
  public static String getValue (Map&lt;String, Map&gt; map,String mapfind, String val) {
  
       Map&lt;Object, Object&gt; mp = map.entrySet().stream()
                  .filter(x -&gt; x.getKey().equals(mapfind))
                  .collect(Collectors.toMap(p -&gt; p.getKey(), p -&gt; p.getValue()));
  
       System.out.println("--------"+mp);
  
       return (String) mp.get(val);
   }
  </code></pre>
  
  <p>but the result is:</p>
  
  <pre><code>--------{MAP|map2={map2|1=2.1, map2|4=2.4, map2|2=2.2, map2|3=2.3}}
  x=null
  </code></pre>
  
  <p>Can you help me with some ideas?</p>