A HashMap is a collection that stores data as key-value pairs. Each key maps to exactly one value, like a dictionary where each word has one definition. You provide a key, and the HashMap gives you back the associated value.
Internally, Java uses a hash function to convert the key into an index for fast lookups. This gives you average time for get, put, and remove operations, with space for entries.
One rule to remember: keys must be unique. If you store a second value under the same key, the new value replaces the old one. Values, on the other hand, can repeat as often as you like.