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
How do you override a private method in java?
What is an image buffer?
Explain the difference between private, public, package and protected in java?
Write a factorial program using recursion in java?
what are different ways in which a thread can enter the waiting state? : Java thread
Does treeset allow null in java?
what is the difference between preemptive scheduling and time slicing? : Java thread
Define interface in java?
What is the difference between abstraction and encapsulation?
What is boolean keyword in java?
Explain 5 features introduced in jdk 1.7?
Where pragma is used?
Is java a compiler?
What is the benefit of using enum to declare a constant?
Give example to differentiate between call by value and call by reference.