Guide to Selecting Appropriate Map/Collection in Java


Java API contains numerous Collection and Map implementations so it might be confusing to figure out which one to use. Here is a quick flowchart that might help with choosing from the most common implementations.

This cheat sheet doesn't include rarely used classes like WeakHashMap, LinkedList, etc. because they are designed for very specific or exotic tasks and shouldn't be chosen in 99% cases. Java Map/Collection Cheat Sheet

If you are interested in other built-in collection implementations, Alexander Zagniotov provided a detailed flowchart for many more collections in his article.

Aug 14, 2009
profile for serg at Stack Overflow, Q&A for professional and enthusiast programmers