An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value.
Then we need the concept of a hash function (from wikipedia):
(turns) some kind of data into a relatively small integer, that may serve as an index into an array. The values returned by a hash function are called hash values, hash codes, hash sums, or simply hashes.
In a Map we store values against a key. In a HashMap, the key is based on the hash code for the object passed in. This provides a faster way to write and retrieve objects from the associated Map.
There are a few tricks to HashMaps, such as efficient sizes and providing effective hashing values (by overriding the hashcode method on the Class), but that's a job for another day
Joined: Feb 01, 2008
ok i understood we take some data put in in some cell in the map and in order to use that data we need the key for it
so how do use this command equals(Object o)
is it like whith objects t.equals(x); because there could be many objects in the map "t" i am puzzled
how do we exctract a certain data from a certain location??
i dont know how to understand the definition for this command hashCode()-Returns the hash code value for this map ??
A Map is a bit like a telephone book. You put in a name and get out a number. If you put("donaldth smithts", 56789) it will record your phone number a 56789. If you write get("donaldth smithts") it will give 56789. If you write put("donaldth smithts", 67890) it will change your phone number to 67890 and forget about 56789.