title: can i use iterable traverse the list again and again in "foreach"?
body: <p>can i use iterable traverse the list again and again?
  when i use ArrayList,i can traverse the list again and again in "foreach" ,but when i use iterable as a parameter in a function in hadoop(a distributed compute framework),only the first time i can traverse the iterable, when i use foreach again , it get nonthing.
  ex:</p>
  
  <pre><code>public void reduce(Text key, Iterable&lt;Text&gt; values, Context context) 
  throws IOException, InterruptedException {
  
  float all=0;
  String resultKey;
  float resultValue;
  ArrayList&lt;String&gt; valuelist=new ArrayList&lt;String&gt;();
  
  for (Text text : values) {
      valuelist.add(text.toString());
  }
  
  for (String text : valuelist) {
      String[] contents=text.toString().split(" ");
      if(contents.length==1)
      {
          all=Float.parseFloat(contents[0]);
          break;
      }
  }
  
  if(all==0)
  {
      return;
  }
  
  for (String text : valuelist) {
      String[] contents=text.toString().split(" ");
  
      if(contents.length&gt;1)
      {
          resultKey=contents[0]+" "+key.toString();
          resultValue=Float.parseFloat(contents[1])/all;
  
          context.write(new Text(resultKey), new Text(resultValue+""));
      }
  }
  }
  </code></pre>
  
  <p>-----i have to save it in the ArrayList first...
  in my understanding, foreach only need an iterable, why ArrayList can,but the parameter can't?
  thanks for reading so much.</p>