![]() ![]() The default size of HashMap is 16 (0 to 15). We use put() method to insert the Key and Value pair in the HashMap. More than one node can share the same bucket. Why do we need a HashMap The simple reason is performance. One might ask why not simply add the value to a list. ![]() A map is a key-value mapping, which means that every key is mapped to exactly one value and that we can use the key to retrieve the corresponding value from a map. Each node has a data structure like a LinkedList. Let's first look at what it means that HashMap is a map.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |