()
| 562 | } |
| 563 | |
| 564 | func ExampleList_Iterator() { |
| 565 | l := NewList[string]() |
| 566 | l = l.Append("foo") |
| 567 | l = l.Append("bar") |
| 568 | l = l.Append("baz") |
| 569 | |
| 570 | itr := l.Iterator() |
| 571 | for !itr.Done() { |
| 572 | i, v := itr.Next() |
| 573 | fmt.Println(i, v) |
| 574 | } |
| 575 | // Output: |
| 576 | // 0 foo |
| 577 | // 1 bar |
| 578 | // 2 baz |
| 579 | } |
| 580 | |
| 581 | func ExampleList_Iterator_reverse() { |
| 582 | l := NewList[string]() |