title: ArrayList add() method acting weird?
body: <p>I'm working on a (double) linked list implementation using "buckets". In short, A doubly linked list of nodes, each node holding an ArrayList of a set size specified by arguments.</p>
  
  <p>I've Initialized my Nodes and list like this:</p>
  
  <pre><code>public class MyLinkedList&lt;T&gt; implements ADTListInterface&lt;T&gt; {
  
  ArrayList&lt;T&gt; list;
  
  private class Node {
  
      T value;
      Node next;
      Node previous;
      ArrayList&lt;T&gt; list;
  
      public Node(Node n, Node p) {
  
          list = new ArrayList&lt;T&gt;(bucketSize);
          next = n;
          previous = p;
      }
  }
  
  private Node head;
  private Node tail;
  private int bucketSize;
  
  public MyLinkedList(int bucketSize) {
  
      this.bucketSize = bucketSize;
      head = tail = new Node(null, null);
  
  }
  </code></pre>
  
  <p>and I have set up my add method like this:</p>
  
  <pre><code>    public void add(T o) {
  
      Node current = head;
  
      while (current.list.add(o) != true) {
  
          if (current.next != null) {
  
              current = current.next;
          }
  
          if (current.next == null) {
  
              current.next = new Node(null,current);
          }
      }
  }
  </code></pre>
  
  <p>When testing the add method with bucketSize = 3 and the following commands:</p>
  
  <pre><code>list.add("a");
  list.add("b");
  list.add("c");
  </code></pre>
  
  <p>I expect the head node to contain a list with elements and order as follows:</p>
  
  <p>c,b,a</p>
  
  <p>However, the line: current.list.add(o) appears to add the specified object multiple times until it fills the list. so my node turns out to contain the elements:</p>
  
  <p>a,a,a</p>
  
  <p>Thank you in advance for looking at my code.</p>