Iterators on Clojure's collections should follow the expected JDK behavior of throwing NoSuchElementException on next() when an iterator is exhausted. Current collections have a variety of other behaviors.
Issue encountered in real world code using http://pipes.tinkerpop.com.
This throws a NPE instead of NSEE.
This throws an ArrayIndexOutOfBoundsException instead of NSEE.
The attached patch fixes the methods by adding a check for hasNext before actually trying to provide the next element. If there is no next element the correct exception is thrown.
Patch: clj-1453-2.patch and tests: CLJ-1453-tests.patch
Screened by: Alex Miller