To my knowledge, Java does not have a foreach
keyword (unlike C# if I am not mistaken). You can however, iterate over all the elements in an Iterable
collection using a modified version of the for loop:
List<String> list = new ArrayList<String>();
...
for (String str : list)
{
System.out.println(str);
}
Check this link for more information.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…