|
A hash map or hash table is a structured data which uses a hash function to for identifying values, which are known as keys. For example an individual’s name. These values are then associated to their values like hand phone number, house address etc. Function of the hash key is the transformation of keys to the index of an element where the related value needs to be sought. In other words a hash table or hash map can be defined as a collection which allows a set of objects for treating them as one unit. Among the java collection frame work, hash table is one core interface. It defines the operations to maintain mappings of keys to their respective and related values. Hash map interface never implement any collections interface. This is because they does not contain any elements, at the same time they have entries of the keys and their respective or related values. This process is called mapping. Mapping also doesn’t allow key duplication. Hence there will be only one value which is mapped with a particular key. Both these keys and respective value must be entered as objects. Hash table contains map interface. It is very important in java frame work. The table automatically grows when you keep on adding elements. The more you add the bigger the table in size. The growing process of a hash table is largely determined by rehashing and copying. The rechaining also affects the process. All of the above affects the overall performance. Performance of hash table or hasp map again depends upon two other factors known as load factor and Initial capacity. The established capacity at the time of hash table creation is called as initial capacity. It is the duty of the load factor to determine when to increase the capacity of the hash table. The default load factor is normally .75. The initial capacity is not necessarily the number of elements that you need to store inside the hash table. The ideal function of the hash table in general is to map each of the possible keys to one unique index. But this one thing is very rare to happen. In a good dimensioned table the cost for single look up will be independent of the element density in the table. Many tables have possible deletion and addition options for keys and values. In general hash table or hash map is very important in the application of caches, sets, unique data representation and data representation in the real world.
_________________
Muhammad Safwat Fuad The Java Code Admin Java Technical Lead. Mobile: +2010-2942-538 Email:mtv134@yahoo.com
|