
1022 CHAPTER 14 An Introduction to Data Structures
50 }
51
52 /** mutator for next
53 * @param pn reference to new PlayerNode
54 */
55 public void setNext( PlayerNode pn )
56 {
57 next = pn;
58 }
59 }
EXAMPLE 14.5 The PlayerNode Class
The code for this class is similar to the code of the IntegerNode class. The
overloaded constructor allows the client to set the Player object, while the
default constructor sets the reference for the Player object to null. Our get-
Player method (lines 28–34) and setPlayer method (lines 44–50) use the
copy constructor of the Player class.
14.2.1 A Linked-List Shell
For our class encapsulating a linked list of Player objects,