|
|
|
@ -42,6 +42,10 @@ type IteratorWithIndex interface {
|
|
|
|
|
// Reset sets the iterator to the initial state.
|
|
|
|
|
// Call Next() to fetch the first element if any.
|
|
|
|
|
Reset()
|
|
|
|
|
// 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.
|
|
|
|
|
First() bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// IteratorWithKey is a stateful iterator for ordered containers whose elements are key value pairs.
|
|
|
|
@ -60,6 +64,10 @@ type IteratorWithKey interface {
|
|
|
|
|
// Reset sets the iterator to the initial state.
|
|
|
|
|
// Call Next() to fetch the first element if any.
|
|
|
|
|
Reset()
|
|
|
|
|
// 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 key and value can be retrieved by Key() and Value().
|
|
|
|
|
// Modifies the state of the iterator.
|
|
|
|
|
First() bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ReverseIteratorWithIndex is stateful iterator for ordered containers whose values can be fetched by an index.
|
|
|
|
@ -94,11 +102,11 @@ type ReverseIteratorWithIndex interface {
|
|
|
|
|
// Last() function to move the iterator to the last element.
|
|
|
|
|
type ReverseIteratorWithKey interface {
|
|
|
|
|
// Prev moves the iterator to the previous element and returns true if there was a previous element in the container.
|
|
|
|
|
// If Prev() returns true, then previous element's index and value can be retrieved by Key() and Value().
|
|
|
|
|
// If Prev() returns true, then previous element's key and value can be retrieved by Key() and Value().
|
|
|
|
|
// Modifies the state of the iterator.
|
|
|
|
|
Prev() bool
|
|
|
|
|
// 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 Key() and Value().
|
|
|
|
|
// If Last() returns true, then last element's key and value can be retrieved by Key() and Value().
|
|
|
|
|
// Modifies the state of the iterator.
|
|
|
|
|
Last() bool
|
|
|
|
|
|
|
|
|
|