foreach - Is there something better than a For loop in Java for iterating neatly through a collection? -


I have been screwed with C # along with Foreach, is there anything like this for Java?

Yes, which was introduced in Java 1.5:

  List & lt; String & gt; String = getStringsFrom (from somewhere); For (string x: strings) {System.out.println (x); }  

This array and Iterable & lt; T & gt; Anything that implements (or raw Iterable type) works.

See for more information.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -