Write a parameterized class definition for a doubly linked list that has a parameter for the type of data stored in a node. Make the node class an inner class. Choosing which methods to define is part of this project. Also, write a program to thoroughly test your class definition.
This program is based on code from Listing 12.9. The solution given here includes support for iteration, both forward and reverse. Both forward and reverse iteration use the moreToIterate method, but backward iteration uses the resetIterationReverse rather than resetIteration. The ListNode class includes a previous instance variable which makes the previous variable in the outer class unnecessary. To make reverse iteration (especially resetIterationReverse) easier to write, there is a reference to the tail of the list as well as to the head of the list. An additional method, findInList, looks for an element in the list and sets current to point to that element if it is found. If it is not found, current is set to null. The method showListState is for testing and debugging purposes and prints the head of the list, the current element, the tail, and the number of elements in the list.
See the code in DoublyLinkedList.java, and DoublyLinkedListDemo.java.
You might also like to view...
You have recently been hired to manage your company's security team. You must ensure that an effective security team is built. Which policies should you keep in mind for this? (Choose all that apply.)
A. Team leadership must be obtained from within the security industry. B. Team members must include individuals from across the entire spectrum of security. C. Team goals must be clearly defined and understood. D. Team actions must have clearly defined rules.
A systems administrator has been tasked to set up a new server to assign IP addresses on the network. The network administrator logs into the server, but cannot find the management tool to create a scope. Which of the following MOST likely happened to cause this?
A. The systems administrator did not configure the routing and remote access server role. B. The systems administrator configured the wrong NTP server address. C. The systems administrator forgot to unblock port 67/68 in the firewall. D. The systems administrator did not install the DHCP server role.