Maps
Maps are Java’s built-in associative data type, often called hashes or dictionaries in other languages.
To create an empty map, use the HashMap
class from the java.util
package:
To run the program, place the code in MapExample.java
and compile and run it using the javac
and java
commands.
Note that maps appear in the form map[k=v, k=v]
when printed with System.out.println
.
Next example: Functions.