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 string in java is it a data type?
Can we return null in java?
Why do people says “java is robust”?
What are the four versions of java?
How can we make a class virtual?
What are different data structures in java?
When a thread is executing a synchronized method , then is it possible for the same thread to access other synchronized methods of an object ?
What is a JAR file?
What is communist flag?
Define interface in java?
What is an infinite loop?
Why static functions are used?
What is int argc char * argv?
How are the elements of a gridbaglayout organized in java programming?
What about abstract classes in java?