title: How to clone a double linked list using recursivity
body: <p>Im trying to implement a method which clones a double linked list. I'm trying to do it recursivity as it's a requirement.</p>
  
  <p>I think that it clones right but when I'm trying to add another element to the end of list, it's added to the original queue and not to the cloned.</p>
  
  <p>this is the main where I call the methods and I do the clone: </p>
  
  <pre><code>    doublelinkedlist&lt;Integer&gt; aux=new doublelinkedlist&lt;Integer&gt;();
      doublelinkedlist&lt;Integer&gt; aux2=new doublelinkedlist&lt;Integer&gt;();
      aux.addRight(10);
      aux.addRight(11);
      aux.addRight(9);
      aux.addRight(12);
      //aux2.addRight(12);
      aux2 = (doublelinkedlist&lt;Integer&gt;) aux.clone();
      aux2.RemoveRight();
      System.out.println("Original Queue: "+aux.toString());
      System.out.println("Copy queue: "+aux2.toString());
  </code></pre>
  
  <p>This is the clone method of DoubleLinkedList:</p>
  
  <pre><code>public Object clone(){
      doublelinkedlist copia = null;
      try{
          copia = (doublelinkedlist)super.clone();
  
          if (left != null){
              copia.left = (node&lt;E&gt;)left.clone();
          }
      }catch (CloneNotSupportedException e){
          return null;
      }
      return copia;
  }
  </code></pre>
  
  <p>and this is the clone of node class:</p>
  
  <pre><code>    public Object clone(){
          node&lt;E&gt; copia = null;
          try{
              copia = (node&lt;E&gt;)(super.clone());
  
              if (next != null){
                  copia.next = (node&lt;E&gt;)(next.clone());
                  copia.prev = copia;
              }
  
          }catch (CloneNotSupportedException e){
              return null;
          }
          return copia;
      }
  </code></pre>