title: Linked List Constructor with initial value
body: <p>I'm working on a Linked List project, and i'm having a great trouble with the constructor.</p>
  
  <p>i already implemented the default constructor (creates empty list. AKA data = null, size = 0) but the other constructor is really confusing me !!!!</p>
  
  <p>i want to implement a constructor that creates a linked list with valueS/elementS in it (String[]). My first thought was "Piece of cake, all i have to do is :</p>
  
  <ul>
  <li>Use the default constructor to create an empty linked list</li>
  <li>Use a for-each loop within a for loop. 
  The for-each loop is to iterate the string array and add them to my empty linked list. 
  The for loop is needed to keep a track of the index."</li>
  </ul>
  
  <p>Here is my Code:</p>
  
  <pre><code>public LinkedList(String[] data)
  {
      LinkedList l = new LinkedList();
  
      for (int i = 0; i &lt;= data.length; i++)
      {
  
          for (String d : data)
          {
              l.add(d, i);
              i++;
          }
  
      }
  }
  </code></pre>
  
  <p>i tested my code by using this constructor but it does not work.
  i know there is a silly mistake somewhere but my logic/mind is blind to see it. </p>