func (list *LinkedList) Enumerate(cancel <-chan struct{}) Enumerator {
	retval := make(chan interface{})

	go func() {
		list.key.RLock()
		defer list.key.RUnlock()
		defer close(retval)

		current := list.first
		for current != nil {
			select {
			case retval <- current.payload:
				break
			case <-cancel:
				return
			}
			current = current.next
		}
	}()

	return retval
}
func (list *LinkedList) Enumerate(cancel <-chan struct{}) Enumerator {
	retval := make(chan interface{})

	go func() {
		list.key.RLock()
		defer list.key.RUnlock()
		defer close(retval)

		current := list.first
		for current != nil {
			select {
			case retval <- current.payload:
				break
			case <-cancel:
				return
			}
			current = current.next
		}
	}()

	return retval
}
func ( list * LinkedList ) Enumerate ( cancel <- chan struct { } ) Enumerator { retval := make ( chan interface { } ) go func ( ) { list . key . RLock ( ) defer list . key . RUnlock ( ) defer close ( retval ) current := list . first for current != nil { select { case retval <- current . payload : break case <- cancel : return } current = current . next } } ( ) return retval }
// Enumerate creates a new instance of Enumerable which can be executed on.
Enumerate creates a new instance of Enumerable which can be executed on .