As we all know with Java comes the Collections API that provide us with numerous data structures that we can use. 开发者_C百科
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.
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.
This should give you a pretty good breakdown...
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
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.
精彩评论