@@ -15,9 +15,9 @@ type IteratorCtrl[T any] interface {
15
15
Valid () bool
16
16
}
17
17
18
- // Iterator represents an iterator over a slice. The underlying slice can
19
- // not be empty. When created, the iterator does not point to a valid
20
- // slice entry. To begin iteration, the client invokes Start. At any one
18
+ // Iterator represents an iterator over a slice. The underlying slice may
19
+ // be empty. When created, the iterator does not point to a valid
20
+ // slice entry. To begin iteration, the client invokes Start. At any stage
21
21
// after the iteration has started, the iterator, points to the current item
22
22
// in the sequence. The client can query the validity of the current item
23
23
// using the Valid method. To obtain successive elements, the client invokes
@@ -42,15 +42,14 @@ type Iterator[T any] interface {
42
42
Next () T
43
43
44
44
// Reset is designed to be used in high frequency applications. The client
45
- // can reuse this entry for a new collection rather that having throw this
45
+ // can reuse this iterator for a new collection rather that having to throw this
46
46
// instance away and create a new one. This helps to reduce the number of
47
47
// allocations in a high frequency application.
48
48
Reset (entries []T )
49
49
}
50
50
51
51
// BeginIt creates a forward iterator over a non empty slice. If the provided
52
- // slice is empty, then a nil iterator is returned. (NB: please remember to check
53
- // for a nil interface correctly; see the helper function IsNil in utils).
52
+ // slice is empty, then a nil iterator is returned.
54
53
//
55
54
// The zero value represents the value that is returned if the Next method on the
56
55
// iterator is incorrectly invoked after Valid has returned false.
0 commit comments