title: Using LinkedList Java Class
body: <p>I am am trying to use the <code>LinkedList</code> class to load an array of anything. I was looking at the documentation of <code>addAll</code> method and it seem to me that I could load an array of stuff with very little effort.  </p>
  
  <blockquote>
  <pre><code>addAll(int index, Collection&lt;? extends E&gt; c) 
        Inserts all of the elements in the specified collection into this list,
        starting at the specified position.
  </code></pre>
  </blockquote>
  
  <p>But I am not so sure on how to structure it. </p>
  
  <p>Let's just say I have an array of Objects and I am trying to load the objects into a link list.<br>
  How would I write this?</p>
  
  <p>NOTE: I am trying to load it to a list because I will be deleting and adding at multiple times.</p>
  
  <p>I used below code but I get an error:</p>
  
  <pre><code>    int[] a = new int[5];
      for(int index = 0; index&lt;5; index++){
          a[index] = index;
  
      }
  
      List&lt;Integer&gt; list = new LinkedList&lt;Integer&gt;();
      list.addAll(Arrays.asList(a)); //error Here won't take a[]
  </code></pre>