Institute of Computer Science
  1. Courses
  2. 2017/18 spring
  3. Object-Oriented Programming (Narva College) (P2NC.01.083)
ET
Log in

Object-Oriented Programming (Narva College) 2017/18 spring

  • Home
  • Materials
  • Java Glossary
  • Source Example
  • Cheat sheet (S1-S6)
  • Grading
  • Links
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
  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment