HashMap
Learn HashMap (Map Interface, Collection Framework) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What is a HashMap? A HashMap stores pairs : a key and the value that belongs to it. You give the map a key and it gives back the value almost instantly, like looking up a city in a telephone-code table: key "Pune" , value 20 . Each key appears once ; each key maps to one value. Package java.util . Implements Map<K, V> . It is not a Collection (it has its own interface). Unique keys: putting an existing key again replaces the value . Values may repeat. Fast: get , put , remove and containsKey are O(1) on average. No order: iteration order depends on hash codes and can change when the map grows....