How to get ComputeIfPresent working with Map within Map? : <p>When trying to alter a Map using the <strong>computeIfPresent()</strong> method I have trouble implementing this method when I use an innerMap. </p>

<p><strong>This works:</strong></p>

<pre><code>Map&lt;String, Integer&gt; mapOne = new HashMap&lt;&gt;();
mapOne.computeIfPresent(key, (k, v) -&gt; v + 1);
</code></pre>

<p><strong>This doesn't work:</strong></p>

<pre><code>Map&lt;String, Map&lt;String, Integer&gt;&gt; mapTwo = new HashMap&lt;&gt;();
mapTwo.computeIfPresent(key, (k, v) -&gt; v.computeIfPresent(anotherKey, (x, y) -&gt; y + 1);
</code></pre>

<p>In the second example  I get the following error message: "Bad return type in lambda expression: Integer cannot be converted to <code>Map&lt;String, Integer&gt;</code>". 
My IDE recognizes v as a Map. But the function doesn't work.</p>

<p>Apparently the method returns an Integer, but I fail to see how this differs from the first method with no Innermap. So far I haven't found a similar case online.</p>

<p>How can I get this to work?</p>
