Rename valid -> has_next.

With the changed implementation, it refers to the next element rather
than the current one. Renaming makes this clearer and matches iterator
interfaces in other languages better.