Guava code. See http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/AbstractIterator.html