Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Interview-Questions when to use ArrayList and when to use HashMap
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Rajendra
when to use ArrayList and when to use HashMap
1 Answer(s)      5 years and 3 months ago
Posted in : Java Interview Questions



Advertisement
View Answers

October 2, 2009 at 12:25 PM


When your application demands saving the objects then ArrayList can be used. But if you need to retrieve the objects more often then HashMap is preferable.This is the basic diff. Aray-List is fast for storing and hashmap is fast for retrieving. If your application needs both storing and retrieving at same no. of times then u can Arraylist for storing and hashmap for the latter purpose.


Related Tutorials/Questions & Answers:
when to use ArrayList and when to use HashMap - Java Interview Questions
when to use ArrayList and when to use HashMap  when to use ArrayList and when to use HashMap in web applications . Thanks Prakash  When... can Arraylist for storing and hashmap for the latter purpose
Example for when to use ArrayList and when to use HashMap - Java Interview Questions
Example for when to use ArrayList and when to use HashMap  Hi Deepak u have replied this answer for when to use arraylist and hashmap " When your... Arraylist for storing and hashmap for the latter purpose. " Can you give
Advertisements
.When to use detached criteria in hibernate?
.When to use detached criteria in hibernate?  When to use detached criteria in hibernate?   Detached Criteria query is a facility provide by Hibernate to write criteria queries in detached mode, where hibernate session
When would you use the Builder Pattern?
When would you use the Builder Pattern?  When would you use the Builder Pattern
When would you use the Builder Pattern?
When would you use the Builder Pattern?  When would you use the Builder Pattern
When are you supposed to use endif to end the conditional statement?
When are you supposed to use endif to end the conditional statement?  When are you supposed to use endif to end the conditional statement
get UnsatisfiedLinkError when I try to use my JDBC driver.
get UnsatisfiedLinkError when I try to use my JDBC driver.  Why do I get UnsatisfiedLinkError when I try to use my JDBC driver
to use ArrayList in the place of Vector
to use ArrayList in the place of Vector  public Enumeration getInterfaces() { ISCMetaType currentType = this; ArrayList allInterfaces = new ArrayList(); while( currentType != null
to use ArrayList in the place of Vector
to use ArrayList in the place of Vector  public Enumeration getInterfaces() { ISCMetaType currentType = this; ArrayList allInterfaces = new ArrayList(); while( currentType != null
JSP JSTL c:when tag
JSP JSTL c:when tag          In this section, you will learn how to use the jstl when tag in jsp. Basically, the choose, when, and otherwise tags can
How to use Arraylist object in <s:dobleselect> .... struts 2? - Struts
How to use Arraylist object in .... struts 2?  Hi Members, I saw the example of tag in roseindia, its very useful. But I have to use my ArrayList object with that tag. Im retrieving the values for arraylist object from
How to obtain the selected data item from a list box when listbox contains objects wrapped under Arraylist?
How to obtain the selected data item from a list box when listbox contains objects wrapped under Arraylist?  I have a jsp page containing a list box... page. The listbox gets populated by the data contained in the arraylist. Now, I
hashmap
hashmap  write a program that shows the use of Hashmap class
Any Link Between ArrayList and HashMap - Java Interview Questions
interview questions which relates ArrayList and Hashmap. I mean how to link ArrayList and HashMap. Thanks Prakash  Hi Friend, Similarities: 1)ArrayList and HashMap both have a capacity. 2)Both are not synchronized. 3)Both
Java HashMap iterator and example
Java HashMap Iterator is an interface. It keeps the data in the key and value form. It is implemented by HashMap. hashMap doesnot have iterator method. So use the entrySet() method to get the data in Set object form. Set's all
Jstl c:when,c:choose,c:otherwise tag in jsp
JSTL c:when,c:choose,c:otherwise TAGS IN JSP In this Section, we will discuss about how to use JSTL tag ' c:when ' in JSP with a simple example. Basically, the choose, when, and otherwise tags are used to construct an "c
Java Hashmap Iterator
Java HashMap Iterator is a collection class. It implements the Map interface. It keeps the data in the key and value form. Java HashMap has no iterator method. So use the entrySet() method.It returns the data in Set object form
HashMap
HashMap  How to work hashmap and hashset internally
the use of ForwardAction
the use of ForwardAction  What is the use of ForwardAction
Java Hashmap Sorting - Java Beginners
Java Hashmap Sorting   I have a sorting issue with a Hashmap. My constraint is that I MUST use the Hashmap and work with existing code. I do a database query and place the results in a Hashmap. When I iterate thru the Hashmap
When will you define a method as static?
When will you define a method as static?  Hi, When will you define a method as static? thanks
when will we get JasperException and parseException?
when will we get JasperException and parseException?  when will we get JasperException and parseException
use forms.
use forms.  How do I use forms
Use of <x:choose> tag of JSTL
Use of <x:choose> tag of JSTL       In this section we will learn how to use <x...; <x:when select="$emp
When is java main method called?
When is java main method called?  When is java main method called...;In a java class, main(..) method is the first method called by java environment when a program is executed. When you execute a class with the Java interpreter
HASHMAP
HASHMAP  HI CAN WE ADD PRIMITIVE DATA TYPE IN HASHMAP IN JAVA 1.5 VERSION . THANKS KALINS NAIK   Java HashMap Example
getting an error when set classpath
getting an error when set classpath  Hello Everyone! i have used hssf model for reading excel sheet in my project & i have set classpath for that jar file but when i compile the program it will compile correctly but when i
Java hashmap, hashtable
Java hashmap, hashtable  When are you using hashmap and hashtable
use of annotation.
use of annotation.  for concurrency which annotation can be used
objective-c when is loadview called
objective-c when is loadview called  How can i load data into loadView instead of ViewDidLoad method. My main aim is to load the data after view get loads. Please suggest
Prompt for a password when deleting a data
Prompt for a password when deleting a data  I am using netbeans and mysql. i have added a username and password. i have a set of data in the database. so when deleting a data it should prompt for the password and if the password
Advertisements
 

 

 

DMCA.com