| Author |
Choosing the right collection
|
O. Ziggy
Ranch Hand
Joined: Oct 02, 2005
Posts: 430
|
|
I am looking for a 'Summary' list of all the Java collections detailing the pros and cons of each. I am particularly interested in things like
- Which provide faster iteration
- Which provide faster search
- Which provide slower iteration
- Which provide faster insertion or removal
I have seen some sites by searching on Google but i am looking for just a summary preferable in table format.
Thanks in advance.
|
 |
Arif Hossain
Greenhorn
Joined: Jun 07, 2006
Posts: 1
|
|
May be you have seen this page already, but it looked like a good summary to me.
Java Collections Overview
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9952
|
|
Note that you are possibly going to have a hard time finding this..."fastest" is usually not something people care about. They generally care about how quickly time grows as the sample grows.
In other words, there may be a collection that always takes 20 seconds to return an element you are searching for. there may be another that take 1/100th of a second per element in the collection. Which is faster?
well, if I have 20 elements, option A takes 20 seconds, option b takes 1/5th of a second.
If i have 1,000,000 elements, option A takes 20 seconds. Option B takes about three hours.
Which collection is 'faster'? The answer is "it depends on your data set".
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
 |
|
|
subject: Choosing the right collection
|
|
|