title: Modifying each item of a List in java
body: <p>I'm just starting to work with lists in java. I'm wondering what the recommended method to modify each element of a list would be?</p>
  
  <p>I've been able to get it done with both the following methods, but they both seem fairly unelegant. Is there any better way to get this done in java? And is any of the below methods recommended over the other, or are both on the same level?</p>
  
  <pre><code>//Modifying with foreach
  for (String each : list)
  {
      list.set(list.indexOf(each), each+ " blah");
  }
  
  //Modifying with for
  for (ListIterator&lt;String&gt; i = list.listIterator(); i.hasNext(); i.next()) 
  {
      i.next();
      list.set(i.nextIndex()-1, i.previous() + " blah yadda");
  }
  </code></pre>