Lab 3

Today we will convert the integer LinkedList that we worked on last week to a generic LinkedList. You should create a directory called lab3 where you will save your work and gsubmit this directory when you are done with the lab.

We start with the integer LinkedList implementation given in mySimpleLinkedList.java. Take a look at how this class is implemented: there is an inner Node class that contains an int and a reference to the previous and next Node (so this is a doubly linked list).

You need to change mySimpleLinkedList.java to make it generic, and call this new class myLinkedList. Hint: to make the class generic use the <> notation to introduce a placeholder for the generic type, and replace int with this placeholder where appropriate; the inner Node class will also need to become generic. When you finish, you should be able to run genericListClient.java. Note how we can use myLinkedList to create myLinkedList<Integer> and myLinkedList<Double> (without having to code two different classes).