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
What if constructor is protected in java?
What are the disadvantages of using inner classes?
What are the different types of inner classes?
What is meant by call by reference?
What is the difference between length and length() method in java?
What happens to the Exception object after handling an exception?
How can we make string upper case or lower case?
If an object reference is set to null, will the garbage collector immediately free the memory held by that object?
What are the restrictions imposed by a Security Manager on Applets?.
What restrictions are placed on method overriding in java programming?
What is the SimpleTimeZone class?
What is byte [] in java?
Explain the difference between the public, private, final, protected, and default modifiers?
Which method cannot be overridden in java?
Write an algorithm program in java for the following question.. 1) S is a set of integers.X is an integer obtained by sum of two digits in S. Write logic for whether or not the X is from the S. The time of algorithm should not exceed o(n logn).