HashMap

  • LoadFactor is 75% if more than that data is reached then memory is doubled
  • Big O Notation
    • Retrieval Time – O(1)

  • HashMap in Java works on hashing principles.
  • It is a data structure which allows us to store object and retrieve it in constant time O(1) provided we know the key. 
  • In hashing, hash functions are used to link key and value in HashMap.
  • Objects are stored by calling put(key, value) method of HashMap and retrieved by calling get(key) method. 
  • When we call put method, the hashcode() method of the key object is called so that the hash function of the map can find a bucket location to store value object, which is actually an index of the internal array, known as the table.
  • HashMap internally stores mapping in the form of Map.Entry object which contains both key and value object.

Leave a Comment