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
Are floats faster than doubles?
What does nextint () do in java?
Write an algorithm for quick sort?
Can we declare the static variables and methods in an abstract class?
What is a method declaration?
Differences between traditional programming language and object oriented programming language?
What is autoboxing and unboxing?
What are the uses of java?
What are the rules for naming an array?
What are design patterns and please explain?
Give a practical example of singleton class usage?
Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?
What are the 5 types of research methods?
What are variable names?
What is boolean flag in java?