Because HahsMap gives better performance if you don’t need sorting then go for HashMap otherwise TreeMap would be choice. You have also option available to use LinkdeHashMap which is same fast as HashMap including it gives remove/add/contains functionality and also maintains insertion order.