Cover Data Structures and Algorithms with Object-Oriented Design Patterns in Java
next up previous contents index

purge Method

Program gif 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).

   program3726
Program: LinkedList class purge method.


next up previous contents index

Bruno Copyright © 1998 by Bruno R. Preiss, P.Eng. All rights reserved.