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



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

Answer / 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

More Core Java Interview Questions

What is empty list in java?

0 Answers  


I have one Shopping cart application, i that i have selected some items, while clicking submit button by mistake i have clicked twice or trice, that time items are selected twice or trice. Actually i want only one copy of items but its selected twice or trice. So how can we avoid this problem?

2 Answers   Honeywell,


What is private static class in java?

0 Answers  


while creating thread why we extend thread class

2 Answers  


How to make a non daemon thread as daemon?

0 Answers  






What is argument in java?

0 Answers  


What is method overloading and method overriding?

0 Answers  


What is nan in java?

0 Answers  


Which is bigger float or double java?

0 Answers  


How do you read a char in java?

0 Answers  


What is a method in programming?

0 Answers  


Package1 and Package2 both have a method name lets say "methodA" with different implementation. When I import both the packages in a java class how can I use both the methods?

7 Answers   Ericsson,


Categories