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 are invisible components?.
What is the difference between the reader/writer class hierarchy and the inputstream/outputstream class hierarchy in java programming?
What are Access Specifiers and Access Modifiers.
Is arraylist ordered in java?
What is the life cycle of Servlet?
What are the different types of java?
What is meant by interface?
What is meant by local variable and instance variable?
What exactly is methodology?
What is Mutex (Mutual Exclusion Object) ?
What is class variable java?
Explain in detail about encapsulation with an example?