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 |
how can we use the servlet as standalone apllication?should we need to extend any class?
How do I find and replace in word?
What is the string function?
Why all programming languages have main as a execution starting point?
Which is dependent variable?
When can you say a graph to be a tree?
How does linkedlist work in java?
What is thread pool in java with example?
Nullpointer exception is a very common exception. Why is it not made as a checked exception?
What is a layout manager?
What is an argument in java?
What is the method overriding?