Why doesn't iterator advance after call to next() method?