Java code to Prevent duplicate pairs in HashMap/HashTable

前端 未结 7 1956
梦谈多话
梦谈多话 2021-01-17 02:32

I have a HashMap as below (assuming it has 10,0000 elements)

HashMap hm = new HashMap();
hm.put(\

7条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-17 02:51

    see even if u write same key values multiple times you will just have unique set of pairs. Check that by either iterating or by doing hm.size();

提交回复
热议问题