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
Can we use string in the switch case?
How will you initialize an Applet?
What is string data?
Explain the difference between call by refrence and call by value?
What is space character in java?
Can static methods be inherited?
Can anonymous class have constructor?
How will you add panel to a frame?
there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box.
Can I extend singleton class in java?
Explain about field hiding in java?
Explain wait(), notify() and notifyall() methods of object class ?
Can a vector contain heterogenous objects?
What is string intern in java?
What is ordered map in java?