21.4.2 Implementing a Generic List Class
The program of Figs. 21.3–21.5 uses an object of our generic List
class to manipulate a list of miscellaneous objects. The program consists of four classes—ListNode
(Fig. 21.3, lines 6–37), List
(Fig. 21.3, lines 40–147), EmptyListException
(Fig. 21.4) and ListTest
(Fig. 21.5). Encapsulated in each List
object is a linked list of ListNode
objects.
Get Java™ How To Program (Early Objects), Tenth 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.