Map Interface in Java

Map Interface

  1. The Map interface does not extend collection interface.
  2. It uses key-value pairs. 

Hash Map

  1.  It is unsorted.
  2. it is unordered.
  3. It uses a hashing technique. 
  4. It does not allow to add a key with a null value.

Hash Table

  1. It uses a Vector, hence it is synchronized.
  2. It is thread-safe.
  3. It is also unsorted an unordered.
  4. It allows to add key with null value.

Linked Hash Map

  1. Insertion order is maintained.
  2. It is sorted.
  3. It is slower in insertion and deletion with hash map.
  4. It has faster insertion.
  5. Faster in iteration.

Tree Map

  1. Data is stored in sorted order.
  2. It is a navigable set.

Tags: No tags

Leave A Comment

Your email address will not be published. Required fields are marked *