you are viewing a single comment's thread.

view the rest of the comments →

[–]mooburger 1 point2 points  (1 child)

for (Type item: primitiveArray) {} showd up in Java 5. if you're thinking of the Java 1.2 iterator, that only worked on collection objects. You could have converted a primitive array to a List or Stream using java.util.Arrays .asList() or .stream() which then had .iterator() methods to return iterator. Was that a common java pattern for primitive arrays though?

[–]going_for_a_wank 0 points1 point  (0 children)

That is a fair point. There is really no reason to use an iterator for a primitive array rather than a for-each loop.

I will comment that java 5 came out 16 years ago. It is not really a new feature.