when to use ArrayList and when to use HashMap

when to use ArrayList and when to use HashMap

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 should you use Docker
When should you use Docker  Hi, I am new to DevOps and want to learn it but donââ?¬â?¢t know when to use Docker. So, can anyone tell me when to use Docker? What are the scenarios when one should use Docker for running
.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
When should you use Hibernate?
When should you use Hibernate in Java Project? Hibernate is ORM framework... number of database. You can use Oracle, MySQL, DB2 and any of supported databases with Hibernate. In this article we are discussing when developer should use
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
When to Use Docker?
Uses of Docker - When to Use Docker? Docker has earned its reputation because... the developers' heart soon after its inception. A developer should know when to use Docker... that suits the production environment. When Not to Use Docker? Docker has
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
ModuleNotFoundError: No module named 'when'
ModuleNotFoundError: No module named 'when'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'when' How to remove the ModuleNotFoundError: No module named 'when' error
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
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
When was Ai invented?
When was Ai invented?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: When was Ai... the topic "When was Ai invented?". Also tell me which is the good
when will we get JasperException and parseException?
when will we get JasperException and parseException?  when will we get JasperException and parseException
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
hashmap
hashmap  write a program that shows the use of Hashmap class
ModuleNotFoundError: No module named 'when-changed'
ModuleNotFoundError: No module named 'when-changed'  Hi, My Python... 'when-changed' How to remove the ModuleNotFoundError: No module named 'when-changed' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'when-will-it-end'
ModuleNotFoundError: No module named 'when-will-it-end'  Hi, My... named 'when-will-it-end' How to remove the ModuleNotFoundError: No module named 'when-will-it-end' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'edx-when'
ModuleNotFoundError: No module named 'edx-when'  Hi, My Python...-when' How to remove the ModuleNotFoundError: No module named 'edx-when... to install padas library. You can install edx-when python with following
When finally block is not executed in Java?
When finally block is not executed in Java?  Hi, I have read that finally block is always executed in Java. But I want to know if there is any conditions when finally is not executed. When finally block is not executed in Java
When finally block is not executed in Java?
When finally block is not executed in Java?  Hi, I have read that finally block is always executed in Java. But I want to know if there is any conditions when finally is not executed. When finally block is not executed in Java
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
Version of com.rabriel>given-when-then dependency
List of Version of com.rabriel>given-when-then dependency
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
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
page is not getting loaded when refreshing???
page is not getting loaded when refreshing???  I am loading an image section(image,demo link,Zoom) in a webpage by using javascript function in JSP... section always but page is not getting loaded after the header section when I
Works when run from desktop but....
Works when run from desktop but....  I used the code provided here for a pie chart using swing in Java, and when I saved it to my desktop, it ran fine, and worked as explained, but then I tried to add the same code to NetBeans
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
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 errors when attempting the following.
Java errors when attempting the following.  Give the java errors in attempting the following : 1) performing division operation on string value. 2) redefining base class final method in derived class. 3) defining a method
When should I learn tensorflow
When should I learn tensorflow  Hi, TensorFlow is now getting used in industry. I am planning to learn it. When should I learn tensorflow? Thanks   Hi, Its always better to learn new technologies asap. Science
When should I learn tensorflow
When should I learn tensorflow  Hi, TensorFlow is now getting used in industry. I am planning to learn it. When should I learn tensorflow? Thanks   Hi, Its always better to learn new technologies asap. Science
Java hashmap, hashtable
Java hashmap, hashtable  When are you using hashmap and hashtable
InputSecret field becomes empty when page is reloaded
InputSecret field becomes empty when page is reloaded  How to fix the problem when h:inputSecret field becomes empty when page is reloaded
How to threow timeout exception when DB is not responding
How to threow timeout exception when DB is not responding  How to throw timeout exception when DB is not responding
How to threow timeout exception when DB is not responding
How to threow timeout exception when DB is not responding  How to throw timeout exception when DB is not responding
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
ModuleNotFoundError: No module named 'txt_when_done'
ModuleNotFoundError: No module named 'txt_when_done'  Hi, My... 'txt_when_done' How to remove the ModuleNotFoundError: No module named 'txt_when_done' error? Thanks   Hi, In your python
Maven Dependency given-when-then >> 0.1.2
You should include the dependency code given in this page to add Maven Dependency of com.rabriel >> given-when-then version0.1.2 in your project
Login Box appears when a button on the webpage is clicked
Login Box appears when a button on the webpage is clicked  How to create a Login Box on a web page that appears only when a button that is already present on the page is clicked
Login Box appears when a button on the webpage is clicked
Login Box appears when a button on the webpage is clicked  How to create a Login Box on a web page that appears only when a button that is already present on the page is clicked
Login Box appears when a button on the webpage is clicked
Login Box appears when a button on the webpage is clicked  How to create a Login Box on a web page that appears only when a button that is already present on the page is clicked
automatically resend when connection lost in sending email
automatically resend when connection lost in sending email  send automatically email when connection lost in sending bulk email using javamail for exp more than 10000 emails
automatically resend when connection lost in sending email
automatically resend when connection lost in sending email  send automatically email when connection lost in sending bulk email using javamail for exp more than 10000 emails
automatically resend when connection lost in sending email
automatically resend when connection lost in sending email  send automatically email when connection lost in sending bulk email using javamail for exp more than 10000 emails
destroy thread when server stoped - Java Beginners
destroy thread when server stoped  Hi, I have written a thread which run continuously in the server. when server stopped or restarted.... How can I destroy the server when the server stopped. I have written

Ads