Description
hasMore: return currentIndex < markup.size(); next: if (++currentIndex < markup.size()) {...} me: while (markupStream.hasMore()) {...}
I get a null element within the while loop which I wouldn't expect to get. markup.size() is 73, currentIndex 72, so "hasMore" returns true, while "next" returns null, because it already advanced the index during its check. "hasMore" saying "yes" while "next" saying "no" seems inconsistent to me, even though one can check the return value of "next" against "null".
Shouldn't "next" use
if (currentIndex++ < markup.size()) {...}
to be in line with "hasMore"? Or more better directly call "hasMore" for the check itself to have only one single consistent implementation of the check?