java - can i use iterable traverse the list again and again in "foreach"? -


Can I repeatedly use an inverted list? When I use the Arialist, I can change the list repeatedly in "repeatedly", but when I use a function as a parameter in the Howau (a distributed computation framework), only for the first time I can cross it repeatedly, when I use it again, it does not get anything pre:

  public zero less (text key, renewable & lieutenant; text & gt; Value, reference reference) IOException It is interrupted; Expansion {float all = 0; String result; Current result of float; ArrayList & LT; String & gt; ValueAlist = New Arrestist & lt; String & gt; (); (Text lesson: value) {valuelist.add (text.toString ()); } (String text: value list) {string [] content = text. the division (""); If (content.length == 1) {all = float.fraphlott (content [0]); break; }} If (all == 0) {return; } (String text: value list) {string [] content = text. the division (""); If (content.length & gt; 1) {resultKey = content [0] + "+ + key.toString (); resultValue = Float.parseFloat (content [1]) / all; Context.write (new text) , New Text (as a result of "+");}}}   

----- I have to save it first in ArrayList ... in my understanding, only one for prostitute It is necessary, why can ArrayList, but the parameter 't? Thanks for reading too much.

This is not generally wrong, but maybe this specific implementation The problem with which the method is being passed by the framework. If you think about it, then that class probably pulled all the elements on the network properly and it will be explained that you Why can not it run again? It is a good solution to save each element if it is actually what you have to do.

Comments