You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

empty.go 250 B

123456789101112131415
  1. package iterator
  2. type emptyIterator[T any] struct{}
  3. func (i *emptyIterator[T]) MoveNext() (T, error) {
  4. var ret T
  5. return ret, ErrNoMoreItem
  6. }
  7. func (i *emptyIterator[T]) Close() {
  8. }
  9. func Empty[T any]() Iterator[T] {
  10. return &emptyIterator[T]{}
  11. }