Abstract Implementations

The collections framework provides various abstract implementations of Collection interfaces from which the programmer can quickly "flesh out" complete customized implementations. These abstract implementations include a thin Collection implementation called an AbstractCollection, a thin List implementation that allows random access to its elements called an AbstractList, a thin Map implementation called an AbstractMap, a thin List implementation that allows sequential access to its elements called an AbstractSequentialList, a thin Set implementation called an AbstractSet and a thin Queue implementation called AbstractQueue. You can learn more about these classes at java.sun.com/j2se/5.0/docs/api/java/util/package-summary.html.

To write a custom implementation, you can extend the abstract implementation class that best meets your needs, and implement each of the class's abstract methods. Then, if your collection is to be modifiable, override any concrete methods that prevent modification.

Категории