Write a method called stutter that doubles the size of a list by replacing every integer in the list with two of that integer. For example, suppose a variable list stores the values [1, 8, 19, 4, 17] , after a call of list.stutter() , it should store [1, 1, 8, 8, 19, 19, 4, 4, 17, 17] .
Add the above method to the LinkedIntList class from this chapter.
Implementation of stutter method:
public void stutter()
{
ListNode current = front;
while(current != null)
{
current.next =
new ListNode(current.data, current.next);
current = current.next.next;
}
}