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 |
What is type casting?
Why Over riding is Run Time Polymorphism?
what are the analysis of an object
What is the difference between method overriding and overloading?
What is a singleton factory?
How many java versions are there?
Why only one Class is public in one file? Explain in details. Thanks in Advance.
What is a “stateless” protocol ?
What is the purpose of static methods and static variables?
What is the use of beaninfo?
Is hashmap thread safe?
What is the arraylist in java?