public class LLDemo2 { // given a reference to the first node of a LL, return an // integer that represents how many nodes are in the list // public static int countNodes( SongNode head) { int counter = 0; SongNode temp = head; while( temp != null) { temp = temp.getNext(); counter = counter + 1; } return counter; } // Given: a reference to the first node in a linked list // and a reference to a node toadd, add the toAdd node // to the end of the linked list public static void addToEnd( SongNode head, SongNode toAdd) { SongNode temp = head; while( temp != null) { temp = temp.getNext(); } temp.setNext( toAdd ); } }