how to double the size of a linked list in java?
<p>For example,given a list such as [1, 2, 3, 4, 5].
After I call doublelist(), the origianl list should be [1, 1, 2, 2, 3, 3, 4, 4, 5 ,5]</p>

<p>Here is my code: </p>

<pre><code>public void stutter(){
    ListNode curr = front;
        while(curr!=null){
        ListNode tempNode = new ListNode();
        tempNode.data=curr.data;
        tempNode.next=curr.next;
        curr.next=tempNode;
        curr=tempNode.next;
    }  
}
</code></pre>

<p>My question is how do I write this method without use  tempNode.data=curr.data?</p>

<p>ListNode.java</p>

<pre><code>public class ListNode {
    public int data;       // data stored in this node
    public ListNode next;  // a link to the next node in the list

}
</code></pre>