when to use ArrayList and when to use HashMap in
webApplication.

Answer Posted / naseer

When you want to retrieve use ArrayList
Dont use ArrayList if the frequent operation is insertion
and deletion instead use LinkedList.

Use HashMap if you want to store interms of Key and Value
pair .
Don’t use a HashMap unless you need the lookup feature. It
takes more time to build a HashMap than an ArrayList.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How would you dynamically allocate memory to an array?

591


What causes memory leaks in java?

490


when a request is generated from apache tomcat 5.5 and goes to oracle 10g or mysql,,, how the oracle or mysql reads the request as apache is a web server and oracle 10g is application server? when the oracle 10g provides response, how the apche tomcat reads it???

1671


What are the difference between composition and inheritance in java?

510


Tell some latest versions in JAVA related areas?

558






What is unicode full form?

551


How can I become a good programmer?

486


How to change the priority of thread or how to set priority of thread?

563


What is e in java?

539


How do you use equal in java?

543


Can we declare a class as static?

590


Which is easier .net or java?

641


What restrictions are placed on method overriding in java programming?

539


What is string in java?

558


How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?

585