• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Choosing the right collection

 
Ranch Hand
Posts: 430
Android VI Editor Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May be you have seen this page already, but it looked like a good summary to me.

Java Collections Overview
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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".
 
My pie came with a little toothpic holding up this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic