General-Purpose Implementations

Fortunately, Sun did not stop with the definition of interfaces when the collections framework was established. The Java API includes seven concrete implementations of the various interfaces found within the framework. These general-purpose implementations will typically suffice when you need a particular collection or map class to support a program. Even if you find a need for a more specialized implementation, you will likely find it easier to use one of the classes in this hierarchy as a starting point rather than implementing one of the interfaces from scratch.

Troubleshooting Tip

If you experience runtime exceptions when using collection classes other than the general-purpose implementations, see "UnsupportedOperationException, ...

Get Special Edition Using Java 2 Standard Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.