- rename Reset() to Begin() in iterators (this will allow End() which will make reverse loops more readable)

This commit is contained in:
Emir Pasic
2016-06-27 00:08:01 +02:00
parent cbc23a5b79
commit 57162feff5
19 changed files with 70 additions and 60 deletions
+3 -3
View File
@@ -143,9 +143,9 @@ func (iterator *Iterator) Index() int {
return iterator.index
}
// Reset sets the iterator to the initial state.
// Begin resets the iterator to its initial state (one-before-first)
// Call Next() to fetch the first element if any.
func (iterator *Iterator) Reset() {
func (iterator *Iterator) Begin() {
iterator.index = -1
}
@@ -153,7 +153,7 @@ func (iterator *Iterator) Reset() {
// If First() returns true, then first element's index and value can be retrieved by Index() and Value().
// Modifies the state of the iterator.
func (iterator *Iterator) First() bool {
iterator.Reset()
iterator.Begin()
return iterator.Next()
}