Java - Custom Linked List Issue
<p>I have created my own custom Linked List (code is below). Now, I can't understand how to create an array of that Linked list like <code>LinkedList[] l = new LinkedList[10]</code>. Can anyone help me.</p>

<pre><code>class Node {
      public int data;
      public Node pointer;
}

class LinkedList {
      Node first;
      int count = 0;

      public void addToEnd(int data){
            if(first == null){
                  Node node = new Node();
                  node.data = data;
                  node.pointer = null;
                  first = node;
                  count = 1;
                  return;
            }
            Node next = first;
            while(next.pointer != null){
                  next = (Node)next.pointer;
            }
            Node newNode = new Node();
            newNode.data = data;
            newNode.pointer = null;
            next.pointer = newNode;
            count++;
      }

      public Node getFirst(){
            return first;
      }
      public Node getLast(){
            Node next = first;
            while(next.pointer != null)
                  next = next.pointer;
            return next;
      }


      public int[] get(){
        if(count != 0){
            int arr[] = new int [count] ;
            Node next = first;
            int i = 0;
                  arr[0]= next.data;
            while(next.pointer != null){
                  next = next.pointer;
                  i++;
                  arr[i] = next.data;
            }
            i++;
            return arr ;
            }
            return null ;
      }
      public int count(){
            return count;
      }
}
</code></pre>
