This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Arraylist Vs LinkedHashMap Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Arraylist Vs LinkedHashMap" Watch "Arraylist Vs LinkedHashMap" New topic
Author

Arraylist Vs LinkedHashMap

Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 309
hi, i want to store some info. in a collection and then later on display it in jsp. The data in the collection does not change . Should i be using ArrayList or LikkenHashMap for faster access of data.

pls give ur agruments.

thnx in advance

NC


SCJP 1.4, SCWCD1.4, OCA(1Z0-007)
Sanjaya Sugiarto
Ranch Hand

Joined: Mar 25, 2004
Posts: 229
ArrayList is faster


<a href="http://www.wi.hs-furtwangen.de" target="_blank" rel="nofollow">Business Information Technology - Hochschule Furtwangen University, Germany</a>
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24081
    
  15

ArrayList is faster if all you're going to do is put data in, then iterate over all of it in the same order. If you need to do any looking-up by key, though, any Map (including LinkedHashMap) will be much faster.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Arraylist Vs LinkedHashMap
 
Similar Threads
ResultSet Serailization
Collections, HashMaps, etc
Adding a value into an existing ArrayList
Last 10 numbers dialed on my cell phone
Declare a PUBLIC Result Set