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
How we can generate random numbers in java?
What is the purpose of a default constructor?
What does .equals do in java?
What is lazy initialization in java?
How many types of methods are there?
why we use merge option in hybernate pls give a ex snippet
Who is the owner of java?
What are 4 pillers of object orinted programming?
Explain about static nested classes in java?
Why convert an applet to an application?
What is the purpose of garbage collection in java, and when is it used?
How many bytes is a url?
What do you mean by byte code?
What is the difference between normal report & matrix report?
Why java is platform independent? Explain.