What are the Differences between map and hashmap?
Answer / 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 |
Why concurrenthashmap is fail safe?
How many types of linked lists are there?
What is structure of data type?
Can you provide some implementation of a dictionary having large number of words?
Define linear probing?
List the applications of set adt?
How many links are there in a binary tree of N nodes?
Explain pre-order and in-order tree traversal.
What do you mean by probing?
Can arraylist be empty?
Differentiate between hashset and treeset.
What is bubble sort technique?