Java Polynomial singly Linked List Question
<p>I have been trying to work on a linked list implementation I thought I had it nailed, but for some reason I can't work out how to add a new node to the list at the start of the list.</p>

<p>This was a polynomial addition method, everything else works as expected, but this section does not work as expected. It returns polynomial with no changes... I think I am missing something really simple but cant see it. </p>

<pre><code>else if (power &gt; polynomial.powerMax())
{

    Polynomial newlink = new Polynomial(coefficient,power);
    newlink.successor = polynomial; 
    polynomial = newlink;

}
</code></pre>

<p>Whole Method</p>

<pre><code>    public class Polynomial 
    {
final static private int mantissa = 52;
final static private double epsilon = Math.pow(2.0, -mantissa);
private double coefficient = 0.0;
private int power = 0;
private Polynomial successor=null;



public Polynomial(double coefficient, int power)
{
    if (Double.isNaN(coefficient)) return;
    if (Math.abs(coefficient) &lt; epsilon) return;
    if (power&lt;0) return;
    this.coefficient=coefficient;
    this.power=power;
}

    public static void add(Polynomial polynomial, double coefficient, int power)
{
    if (polynomial == null) return;
    if (Math.abs(coefficient) &lt; epsilon) coefficient = 0.0;
    if (coefficient == 0.0) return;
    if (power &lt; 0) return;

    if (power &lt; polynomial.powerMin())
      {
        Polynomial newNode = new Polynomial(coefficient,power);
        if (polynomial.successor != null)
        {
            while (polynomial.successor != null)
            {
                polynomial.successor = polynomial.successor.successor;
            }

            polynomial.successor = newNode;
        }

        else if (polynomial.successor == null )
            polynomial.successor = newNode;

      }
    else if (power &gt; polynomial.powerMax())
    {

        Polynomial newlink = new Polynomial(coefficient,power);
        newlink.successor = polynomial; 
        polynomial = newlink;

    }

    else
    {
     if (power == polynomial.power)
         polynomial.coefficient = polynomial.coefficient + coefficient;

    }

}
</code></pre>
