title: Iterable to ArrayList elements change
body: <p>So I am implementing a mapreduce job which means I am dealing with key value pairs.  </p>
  
  <p>I have the variable </p>
  
  <pre><code>Iterable&lt;FreqDataWritable&gt; values
  </code></pre>
  
  <p>FreqDataWritable is an object that contains pieces of information, but for now I am only concerned with one piece of information it holds which is a String which is accessed by getFilename().</p>
  
  <p>I have the following loop:</p>
  
  <pre><code>ArrayList&lt;String&gt; filenames = new ArrayList&lt;String&gt;();
  
  for(FreqDataWritable i : values) {
      filenames.add(i.getFilename());
  }
  </code></pre>
  
  <p>Now all I want to do is print the values in the array list filenames.</p>
  
  <pre><code>for(int i = 0; i &lt; filenames.size(); i++) {
      System.out.println(filenames.get(i));
  }
  </code></pre>
  
  <p>However when I do this everything in filenames is the same. The only thing printed out is a single filename printed multiple times.</p>
  
  <p>My original code is more complex than this, but I simplified it for help.  Anyone know how to fix this? </p>
  
  <p>Thanks</p>