Hi Friends, Can u give few interview questions which relates
ArrayList and Hashmap. I mean how to link ArrayList and
HashMap.I know this is not good way of asking questions like
this , but i need
Answer Posted / murali,25@gmail.com
HashMap stores key-value pairs. Alternate approach is to have a plain java class with key,value as attributes.
class HashMapAlternate{
Object key;
Object value;
}
You can create objects of HashMapAlternate and store it in arraylist. But HashMap is a better solution because it uses hashing and collision resolution technique which speeds up lookup when number of objects are very large.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is the += operator called?
How to avoid memory leak in java?
What is a java string?
When is the finalize() called?
What are thread local variables?
What is a instance variable in java?
Difference between string, stringbuffer and stringbuilder?
If I don't provide any arguments on the command line, then what will the value stored in the string array passed into the main() method, empty or null?
What is static in java?
What is re-factoring in software?
What does 3 dots mean in java?
What is the difference between static class and normal class?
What is a marker interface?
Difference between Preemptive scheduling vs. Time slicing?
What is a line separator in java?