Replace strings that match keys in map using lambda
<p>Using this code : </p>

<pre><code>import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.stream.Collectors;

public class Replace
{

    public static void main(String args[]){
        Map&lt;String , String&gt; map = new HashMap&lt;String , String&gt;();
        map.put("eleven", "11");

        String str = "replace the 11";

        List&lt;String&gt; ls = Arrays.asList(str.split(" "));

        ls.stream().map(m -&gt; map.entrySet().forEach(e -&gt; m.replaceAll(m , e.getKey())));
    }

}
</code></pre>

<p>I'm attempting to replace occurrences of "11" in the String str with "eleven". So str should be converted to "replace the eleven".</p>

<p>But I'm receiving compiler error : </p>

<pre><code>Multiple markers at this line
    - Type mismatch: cannot convert from Stream&lt;Object&gt; to 
     &lt;unknown&gt;
    - Cannot return a void result
</code></pre>

<p>How to replace occurrences of keys in map that match string values ? </p>