Sunday, January 16, 2011

HashMap Class

HashMap:
  1- deleration of HashMap is following
     public class HashMap extends AbstractMap
     implements Map, Cloneable, Serializable {}
  2-The HashMap gives you an unsorted, unordered Map.
  3-HashMap allows one null key in a collection and multiple null values in a collection.
  4-This class makes no guarantees as to the order of the map
  5- Iteration over collection views requires time proportional  to the "capacity" of the HashMap instance (the number of  buckets) plus its size (the number of key-value mappings). Thus, it's very important not to set the initial capacity  too high (or the load factor too low) if iteration performance is important.
  6- HashMap has two parameter that affect its performance
     1-initial capacity
     2-load factor
     initial capacity: capacity at the time the hash table is      created .
     Load Factor :if the Hash table  is full ,then load factor is      automatically increased the size of HashMap.