You can use an enhanced for loop: Set<String> set = new HashSet<String>(); //populate set for (String s : set) { System.out.println(s); }. Or with Java 8: ... <看更多>
and to execute the actions contained within it for each item in the collection. */. public class Foreach extends Action implements ActionsContainer {. ... <看更多>
This rule replaces enhanced for loops (for-each-loops) with an invocation of 'java.lang.Iterable::forEach' method and passes the body of the for-loop as a ... ... <看更多>