title: Prepend function of my recursive list creates an endless list
body: <p>Currently, I'm working on a generic list in Java. Problem: The prepend method doesn't work the way it should. Instead of adding an element T at index 0 it's creating an endless recursive list.</p>
  
  <pre><code>public class Vector&lt;T&gt;{
  
      private T value;
      private Vector&lt;T&gt; next = null;
  
      public Vector(T value){
          this.value = value;
      }
  
      public Vector(T value, Vector&lt;T&gt; next){
          this.value = value;
          this.next = next;
      }
  
      public void prepend(T element){
          this.next = this;
          this.value = element;
      }
  }
  
  
  
  public class Main{
      ...
      Vector&lt;Integer&gt; v1 = new Vector&lt;Integer&gt;(new Integer(1));
      v1.prepend(new Integer(0));
      ...
  
  </code></pre>
  
  <p>Expected output: {0,1}
  Actual output: {0,0,0,0,0,0,0, ........ }</p>