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 deserialization?

816


Can size_t be negative?

816


What are bind parameters?

777


Can we use catch statement for checked exceptions?

768


What are filterstreams?

847


Explain the purpose of garbage collection in Java?

800


What is the length of a string?

760


what invokes a threads run() method? : Java thread

785


What is the size of int?

860


What is return data type?

792


Can singleton class be serialized?

743


What is the meaning of flag day?

762


What does math floor () do?

748


Why is an interface be able to extend more than one interface but a class can’t extend more than one class?

954


What is a boolean field?

742