title: Adding and object to a list inside a while loop
body: <p>I'm trying to loop a list and that list have 4 arrays inside and each array have 7 values</p>
  
  <p>I am looping the list and then when I get an array from the list, since I know how many values have the array I assign each array index like this: <code>personObject.setName(String.valueOf(myArray[0])</code> and then at the end of the while loop I add to a list of Persons the personObject like this: listOfPersons.add(personObject).</p>
  
  <p>My problem is that my list only gets populate with the same object and I know that the 4 arrays inside the list that I'm looping have different values, here is my code:</p>
  
  <pre><code>ArrayList&lt;Object&gt; objectList= null;
  objectList= _serviceVariable.getObjects(); &lt;--- this works it returns a list with 4 arrays all with diferent values
  
  Person myPerson = new Person();
  List&lt;Person&gt; personsList = new List&lt;Person&gt;; 
  
  Iterator&lt;Object&gt; itr = objectList.iterator();
  
  while(itr.hasNext())
          {
  Object[] innerObj = (Object[]) itr.next();
  
  myPerson.setName(String.valueOf(innerObj [0])
  myPerson.setLastName(String.valueOf(innerObj [1])
  myPerson.setNickName(String.valueOf(innerObj [2])
  
  personsList.add(myPerson); 
  }
  </code></pre>
  
  <p>when I print my persons list is full of persons with the same name, lastName and nick name, is a list full of the same objects with the same values.</p>