Session 4 |
HashMaps
Java has a few 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 in the first test, but maybe you will need it in your 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 |