Why string is popular hashmap key in java?
Answer / vishalshetkar
Since String is immutable, its hashcode is cached at the time of creation and it doesn’t need to be calculated again. This makes it a great candidate for keys in a Map and its processing is fast than other HashMap key objects. This is why String is mostly used Object as HashMap keys.
| Is This Answer Correct ? | 0 Yes | 0 No |
why the abstract class has default constructor?
Can one thread block the other thread?
how do I create a runnable with inheritance? : Java thread
What is the latest java version?
Why is java so popular?
Difference between notify() method and notifyall() method in java?
What is scope of a variable?
How is object created in java?
Which containers may have a MenuBar?
What's the difference between int and integer in java?
What is a stack class in java ?
0 Answers Akamai Technologies,
What are the changes in java.io in java 8 ?