ProAnswers.org

What is difference between HashMap and TreeMap?

HashMap TreeMap

  1. HashMap is can contain one null key.1) TreeMap connot contain any null key.

  2. HashMap maintains no order. 2) TreeMap maintains ascending order.