@@ -149,8 +149,8 @@ func (s *Slice[T]) Seq() iter.Seq[T] {
}
}
-// SeqWithIndex returns an iterator that yields index-value pairs from the slice.-func (s *Slice[T]) SeqWithIndex() iter.Seq2[int, T] {
+// Seq2 returns an iterator that yields index-value pairs from the slice.
+func (s *Slice[T]) Seq2() iter.Seq2[int, T] {
// Take a snapshot to avoid holding the lock during iteration
items := s.Slice()
return func(yield func(int, T) bool) {
@@ -250,7 +250,7 @@ func TestSlice(t *testing.T) {
var indices []int
var values []string
- for i, v := range s.SeqWithIndex() {
+ for i, v := range s.Seq2() {
indices = append(indices, i)
values = append(values, v)
}