Data Structures and Algorithms
with Object-Oriented Design Patterns in Java
Program
gives the code
for the purge method of the LinkedList class.
The purpose of this method is to discard the current list contents
and to make the list empty again.
Clearly, the running time of purge is O(1).

Program: LinkedList class purge method.
Copyright © 1998 by Bruno R. Preiss, P.Eng. All rights reserved.