Java Reference
In-Depth Information
Chapter
17
Inheritance
and Lists
Contents
Using Inheritance to Implement a Sorted List
Designing a Base Class
Creating an Abstract Base Class
An Efficient Implementation of a Sorted List
The Method add
Prerequisites
Appendix C
Creating Classes from Other Classes
Chapter
12
Lists
Chapter
13
List Implementations That Use Arrays
Chapter
14
A List Implementation That Links Data
Chapter
16
Sorted Lists
Objectives
After studying this chapter, you should be able to
Describe how a class implementation that uses inheritance differs from one that uses composition
Design a class that contains protected methods to make it suitable for use as a base class
Write an efficient implementation of a sorted list by using inheritance
C hapter 16 introduced you to the ADT sorted list, which maintains its entries in a
sorted order. As with many other ADTs, you can implement the sorted list by using
either an array or a chain of linked nodes. The advantage of such implementations is
their time efficiency. However, they require you to repeat a portion of the
implementation of the ADT list, since the ADTs sorted list and list have several
operations in common.
 
 
 
Search WWH ::




Custom Search