9
There is one GenericLinkedList
object, and four GenericNode
objects
each with an Integer
object
Here is the testing program (again):
public class GenericLinkedListTester { public static void main( String[] args ) { // create an empty generic linked list GenericLinkedList<Integer> list = new GenericLinkedList<>(); // insert some integers (autoboxed) list.insertFirst( 4 ); list.insertFirst( 3 ); list.insertFirst( 2 ); list.insertFirst( 1 ); list.traverse(); System.out.println("\n"); // test getFirst() System.out.println("First: " + list.getFirst() ); list.deleteFirst(); list.traverse(); System.out.println("\n"); System.out.println("New First: " + list.getFirst() ); // test getLast() System.out.println("Last : " + list.getLast() ); } }
How could you change the program so that it works with Double
objects?