chore: rename seq2

This commit is contained in:
Kujtim Hoxha
2025-07-25 16:00:18 +02:00
parent e18a77f5df
commit ee45939529
2 changed files with 3 additions and 3 deletions

View File

@@ -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) {

View File

@@ -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)
}