Session 4 |
HashMaps
Java has a many more different data structures. We will study them in detail in the second half of the semester. At moment we will also get a brief look at HashMaps as well (analogy in Python would be dict()). This topic will not be included into the first test, but you may need it in your first project.
// the first data type in the braces is for the keys, the second one - for the values HashMap<String, String> numbers = new HashMap<>(); numbers.put("emergency", "112"); numbers.put("taxi", "1918"); String taxi = numbers.get("taxi"); // "1918"
Useful link: Other useful methods of HashMap class can be found here here.
Session 4 |