Is there a way to define function-dictionaries in android/Java like in python?
<p>In python it is possible to create a dictionary of functions (<code>foo,bar</code>) and call them by accessing the dictionaries element:</p>

<pre><code>d = {'a':foo, 'b':bar}
d[val]()
</code></pre>

<p>In this example if <code>var='a'</code> the function <code>foo</code> is called, and if <code>var='b'</code> the function <code>bar</code> is called (other choices lead to errors).</p>

<p>Can I do something like that in android/Java?</p>

<p>In Java Dictionaries we will Call it as HashTable / HashMap.</p>

<p>Please have a look at this Classes. 
<a href="https://developer.android.com/reference/java/util/Hashtable.html" rel="nofollow">https://developer.android.com/reference/java/util/Hashtable.html</a></p>

<p>Example of HashTable:
<a href="https://www.tutorialspoint.com/java/java_hashtable_class.htm" rel="nofollow">https://www.tutorialspoint.com/java/java_hashtable_class.htm</a></p>

<p><a href="https://developer.android.com/reference/java/util/HashMap.html" rel="nofollow">https://developer.android.com/reference/java/util/HashMap.html</a></p>

<p>Hope this will helps you :)</p>

java android python dictionary