Question: Using only the public interface of the linked list class, write a method public static void reverse(LinkedList staff) that reverses the entries in a linked
Using only the public interface of the linked list class, write a method public static void reverse(LinkedList
You need to supply the following class in your solution:
ListUtil
Use the following class as your tester class - DO NOT MODIFY THE BELOW CLASS!
import java.util.LinkedList; import java.util.ListIterator; /** A test program to reverse the entries in a linked list. */ public class ReverseTester { public static void main(String[] args) { LinkedList names = new LinkedList(); names.addLast("Dick"); names.addLast("Harry"); names.addLast("Romeo"); names.addLast("Tom"); ListUtil.reverse(names); System.out.println(names); System.out.println("Expected: [Tom, Romeo, Harry, Dick]"); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
