IN JAVA. please post as copyable text code, Not an image. below is the code for
ID: 3836940 • Letter: I
Question
IN JAVA. please post as copyable text code, Not an image.
below is the
code for a LinkedIntList and a test program Write a method utter in this class that doubles the size of a linked list by st replacing every integer in the list with two of that integer. For example suppose an instance of LinkedIntList called list stores the following sequence of integers: [1, 8, 19 4, 17 After a call of list. stutter it should store the following sequence of integers: L1, 1, 8, 8, 19, 19, 4, 4, 17, 171 Assume that you are adding this method to the LinkedIntList class as defined below: public class LinkedIntList f private ListNode front r null for an empty listExplanation / Answer
public void stutter()
{
ListNode temp = front;
if (front == null) {
return;
}
while(temp != null)
{
ListNode nn = new ListNode(temp.data);
nn.next = temp.next;
temp.next = nn;
temp = nn.next;
}
}