Collections and Maps

I have been studying up on the Java Collections Framework for the past week. It was hard to get a grasp on such a huge subject. Initially I had trouble figuring out what were the interfaces and what were the classes. With the help of Wikipedia and the Java API documentation, I think I am starting to understand it a little better.

There are really two main things to get here - collections and maps. Collections is the bigger piece. The grandfather interface is Collection (from java.util.Collection). A couple important interfaces extend Collection. They are List, Queue, and Set. You then get a bunch of classes that implement these interfaces. Do not get confused by some base classes which are then extended to the classes you use on a daily bases.

Maps are their own thing in that they store pairs of keys and values. Like the Collection interface, maps start with the Map interface. Then you have some classes that implement Map. Those classes are often extended to give you convenient classes to do your work.

One thing that is common to all this is that you need to write some code to get a feel for using the collections and maps. When in doubt of the hierarchy, take a look at the UML diagrams from Wikipedia on Collection and Map.