Create methods for a class that represents a linked list. Our class will contain one string, and then either a null value or a reference to the next portion of the linked list. You will be writing some methods for various purposes.
Linked lists make it easy to add and remove items from it. Unlike arrays, you only need to change one or two nodes, and you do not need to recreate the whole linked list.
A linked list is a simple data structure. Each java object (the link) contains a value (in this example, a word) and a reference to the next link. If the reference is null, then there are no more links (the link is at the end of the list). We've created the class for you. Your challenge is to implement the forward and tail recursive methods. In the first four examples, we'll demonstrate using a linked list of three items: "one", "two", and "three".
Hint: Rather than using a loop, create a recursive helper method. Pay attention to the type of recursion you choose for each method. Most of the problems will probably lend themselves to forward recursion. The toString() and getCount() methods are already written. You can look at them for ideas on how to implement the other methods. They are both forward recursive methods, and are very similar to some of the methods that you will write. They first test to see if they are at the base case. If not, they add their current value (whether a count or the current string) and call themselves again on the next value.