11

As we all know with Java comes the Collections API that provide us with numerous data structures that we can use.

I was wondering if there is some collection/tutorial/advice that could explain the situations and best Collection for the problem.

Example : LinkedHashMap is good for building LRU caches.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
daydreamer
  • 87,243
  • 191
  • 450
  • 722
  • Here is a tutorial that will reap dividends over and over: [The Google Guide](http://www.googleguide.com/). In no time at all, you'll find the [java Collections tutorial](http://download.oracle.com/javase/tutorial/collections/index.html) – President James K. Polk Nov 27 '10 at 04:36

4 Answers4

23

I just came across this question but I recently posted a Q&A here What Java Collection should I use? that also answers this question.

Collections Flow Chart

Community
  • 1
  • 1
Tim B
  • 40,716
  • 16
  • 83
  • 128
  • 3
    When you know another question where a question is already answered, please mark it as a duplicate. – Philipp May 12 '14 at 07:05
9

This should give you a pretty good breakdown...

Aaron McIver
  • 24,527
  • 5
  • 59
  • 88
3

There are enough answers provided already but I would like to augment those with few "application" areas where certain data structures are being used to solve problems

List of most of the data structures can be found on wikipedia here. Most of them have a "Applications" section that describes the problem domain it is solving

Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327
2

Just reading when to use what collection will only help you if you run across the exact same situation in your code. If you don't understand the roots of why a given data structure is good for a problem, you won't be able to apply this to your own code. This is why computer science is still important in programming...

So my roundabout answer, is take data structure classes or read data structure books, and understand how they work.

bwawok
  • 14,898
  • 7
  • 32
  • 43