-
Here are some of the specifications for the methods to be added to the SinglyLinkedList
class:
-
You are to write a method insert
that builds the linked list in order based on the id value.
-
A find
method will check the list for a specific id value, returning a reference to such a node if the value exists in the list. If the value is not found, the method should return a null
value.
-
A remove
method will remove unwanted data from the linked list.
-
Write a clear
method that clears the entire list.
-
Write a loadData
method.
-
Code a recursive printBackward
method that prints out the linked list contents in reverse order.
-
Write a testing method with the following specifications.
-
A method addLast
is provided which builds the list just as in Lab Assignment AB29.1, List1
. The list will be built in the same order as it exists in the data file. The routine that reads the data from the text file has been separated from the method to insert the information into the linked list. See the code in the program shell.
-
The find
method returns a null value.
-
The remove
method returns a null value.
-
The clear
method is stubbed out as a print statement.
The printBackwards
method is stubbed out as a print statement.
-
The size
method returns 0.
-
Methods to read the data file and print the list are provided.
-
Modify and write code as necessary to satisfy the above specifications.
-
Print out the entire source code.
-
Include a printed run output of the following:
-
The entire list printed in ascending order. Include a call of the size
method and print the number of nodes.
-
Print the list backward using the recursive printBackward
method. Do not worry about printing a line number in this algorithm.
-
The id
’s you searched for and their corresponding inventory amounts. Your instructor will specify which id
values to search for.
-
Delete id
values as specified by your instructor. Print the abbreviated list after values have been deleted and include a call to size
.
-
Clear the entire list of all nodes. Call the size
method one last time.