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


Please Help Members By Posting Answers For Below Questions

Can we use string in the switch case?

572


How will you initialize an Applet?

614


What is string data?

549


Explain the difference between call by refrence and call by value?

557


What is space character in java?

565






Can static methods be inherited?

531


Can anonymous class have constructor?

548


How will you add panel to a frame?

640


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.

1571


Can I extend singleton class in java?

620


Explain about field hiding in java?

523


Explain wait(), notify() and notifyall() methods of object class ?

585


Can a vector contain heterogenous objects?

588


What is string intern in java?

545


What is ordered map in java?

531