- iterator first on all structures with reversible iterators

This commit is contained in:
Emir Pasic
2016-06-26 22:50:14 +02:00
parent 3d1014bf63
commit bdfeab4912
10 changed files with 86 additions and 6 deletions
+8
View File
@@ -149,6 +149,14 @@ func (iterator *Iterator) Reset() {
iterator.index = -1
}
// First moves the iterator to the first element and returns true if there was a first element in the container.
// 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()
return iterator.Next()
}
// Last moves the iterator to the last element and returns true if there was a last element in the container.
// If Last() returns true, then last element's index and value can be retrieved by Index() and Value().
// Modifies the state of the iterator.