Response to the critique for my last post and OneElementIterator

I’ve wrote an update to the post where someone suggested in a trackback to use the JDK for an one element iterator.

I got interested in aa OneElementIterator, which optimized – not sure how fast try is – could look like this:

Faster and shorter ideas?

Update: Remove got lost during cut & paste:

And as Eugene noted next() should throw NoSuchElementException .

Comments are closed.