adspace
Answer Posted / Rahul Yadav
Map and HashMap are both implementations of Map interface in Java. Here are their key differences:n
1. Implementation: HashMap is a concrete implementation of the Map interface, while Map is an abstract class that provides a common interface for various concrete implementations (such as HashMap, TreeMap, LinkedHashMap, etc.).n
2. Default Initial Capacity and Load Factor: The default initial capacity and load factor of HashMap are 16 and 0.75, respectively. These values can be customized when creating a new instance of HashMap.n
3. Ordering: HashMap does not maintain any ordering for its keys (neither insertion order nor sort order). TreeMap, on the other hand, stores keys in sorted order based on their natural ordering or a custom Comparator provided by the user.n
4. Null Keys and Values: Both HashMap and Map allow one null key but not more than one, and both can have multiple null values.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Draw a binary Tree for the expression : A * B - (C + D) * (P / Q)
Can you declare an array without assigning the size of an array?
Write a program for Sorting an Array. Which sorting will you prefer?
“int a[] = new int[3]{1, 2, 3}” – This a legal way of defining the arrays?
For the following COBOL code, draw the Binary tree? 01 STUDENT_REC. 02 NAME. 03 FIRST_NAME PIC X(10). 03 LAST_NAME PIC X(10). 02 YEAR_OF_STUDY. 03 FIRST_SEM PIC XX. 03 SECOND_SEM PIC XX.
What sort of serious problems have you experienced, and how have you handled them?