Forgot your password?
typodupeerror

Comment Question regarding enhanced for ... (Score 1) 839

Collection c; ... for (String s : c)

What if I have a data structure that is logically iterable yet not a Collection nor an array? How would I use for in say, a Vector or Matrix class of my own design? What if I wanted that for loop to iterate over the elements of a Matrix in some nonstandard denumerable manner?

It would seem more logical to me for Java to simply apply allow blocks as used in Smalltalk.

URL : Enhanced for discussion on JCP site

URL : About Smalltalk Blocks

Slashdot Top Deals

Real Users never use the Help key.

Working...