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

What is the purpose of the enableevents() method?

577


What is logical variable?

505


Which is dependent variable?

487


Give an example of call be reference significance.

605


Describe how to implement singleton design pattern in struts.

525






What sorting algorithm does javascript use?

526


What is the static block?

582


Difference between a class and an object?

571


What is charat ()?

525


What is the flag in java?

605


What is float in java?

557


What is the platform?

526


What checkbox method allows you to tell if a checkbox is checked?

531


I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?

633


Explain the difference between extends thread vs implements runnable in java?

530