A DESCRIPTION OF THE REQUEST :
Currently, the for/in statement (ie for(Date date : collection)...) only supports Iterable and Object as the source of objects to iterate over. There is no reason why this statement should not support Iterators directly. For instance, the following code should work
List<Integer> myList = buildIntegers();
for (Integer integer : myList.iterator())
Sometimes I will have a method other than iterator() that returns the iterator I want to travers. For instance, I could have a method that returns an iterator over a subset of objects in the source object...
Right now, I'm forced to use old style for loops with iterators. I'd like to be able to type
for (Integer integer : myList.getOddIntegers())
EXPECTED VERSUS ACTUAL BEHAVIOR :
If I pass an iterator as the argument to a for/in loop after the colon, it should just work.
I get a compile error when I try this now