java 8 - store method in HashMap and get return value from method in map
<p>I want to store methods pointer in map to execute them based on a string value. Аrom what I found, I can use <code>Map&lt;String, Runnable&gt;</code> to do it, but the problem is I want to get the return value from the method.</p>

<p>Say I have something like this:</p>

<pre><code>private Map&lt;String, Runnable&gt; timeUnitsMap = new HashMap&lt;String, Runnable&gt;() {{
    timeUnitsMap.put("minutes", () -&gt; config.getMinutesValues());
}}
</code></pre>

<p>The method <code>config.getMinutesValues()</code> is from another class.</p>

<p>How can I do <code>int value = timeUnitsMap.get("minutes").run();</code> or to store something else in the map (instead of <code>Runnable</code>) in order to get the value from the function in the map?</p>