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 destructors are defined in java?
What are three types of loops in java?
Which container method is used to cause a container to be laid out and redisplayed in java programming?
What is boolean example?
What are benefits of java?
Explain notifyall() method of object class ?
What are different types of Exceptions?.
how to connect two diffrent applet files
Explain the use of javap tool.
Define locale.
What mechanism does java use for memory management?
What is HashTable?