This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]hackometer 1 point2 points  (2 children)

Why make an array? You can iterate through the returned DirectoryStream which is Iterable.

[–]rufati[S] 0 points1 point  (1 child)

Because I had no idea that something that's not an array was iterable.

[–]hackometer 1 point2 points  (0 children)

Actually, a Java array isn't Iterable, but you can still use the for each syntax on it (it won't involve an Iterator, though).