Java method doesn't return the first value of a linked list
<p>I am trying to write a peek method for a header linked list class. However, it doesn't return the first value.</p>

<pre><code>public E peek () throws NoSuchElementException {
  ListNode&lt;E&gt; temp = highest;
  ListNode&lt;E&gt; r = temp;

  if (temp.next == null) throw new NoSuchElementException();
  else r.next = temp.next.next;

  return r.next.value;
}
</code></pre>

<p>I understand why it doesn't return the first value. Because in my code <code>else r.next</code> will already point to the next node in the list. So for 5,4,3,2,1 it will return 4 on the first call instead of 5. temp is pointing to the highest node which is the header node. How can I get the method to return the first value in the list, 5, first?</p>
