<p>I am adding objects into a java Vector using its add(Object) method.
In my example, the first 5 objects are identical, followed by 2 instances different from the first five.
For some reasons, as soon as I insert the first one that is different, it changes the entire vector to that value!</p>

<p>'values' is an iterator containing something like
'1','1','1','1','1','2','2'</p>

<pre><code>
Vector temp = new Vector();    
while (values.hasNext()) {
     temp.add(values.next());
     System.out.println(temp.toString());
}
</code></pre>

<p>It will output something like</p>

<blockquote>
  <p>[1]<br>
  [1,1]<br>
  [1,1,1]<br>
  [1,1,1,1]<br>
  [1,1,1,1,1]<br>
  [2,2,2,2,2,2]<br>
  [2,2,2,2,2,2,2]  </p>
</blockquote>

<p>I tried using a LinkedList, as well as using add(object, index). Same thing happened.</p>

I suspect that, somehow, the "objects" you are getting from the iterator are really multiple references to a single instance of a mutable object, which is changing its state from "1" to "2". The thing I can't guess at is how it's changing state in this apparently single-threaded operation.
Can you post more complete code? Show where
```
values
```
comes from and how it is initialized.