title: Using for-each loop in java
body: <p>In my code, </p>
  
  <pre><code>for(City city : country.getCities()){
     // do some operations
  }
  </code></pre>
  
  <p>Using country.getCities() is costly? Will JVM maintain the stacktrace for every call..?</p>
  
  <pre><code>List&lt;City&gt; cityList = country.getCities();
  for(City city : cityList){
     // do some operations
  }
  </code></pre>
  
  <p>What is the best way to use?</p>