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 equals method can be override?when we override the equals method?
What is runtime polymorphism or dynamic method dispatch?
which of tha following is not a thread safe class? a) ArrayList b)Vector c)HashTable d)None
What is module with example?
What is java in layman terms?
What is java command?
What are the differences between this and super keyword?
What is difference between core java and java ee?
Do you need to import math in java?
How can an object be unreferenced?
Write a java program to generate fibonacci series ?
How do I write a self declaration?