github.com/chain5j/chain5j-pkg@v1.0.7/collection/queues/queue/interator.go (about)

     1  // Package queue
     2  //
     3  // @author: xwc1125
     4  package queue
     5  
     6  type Iterator struct {
     7  	current *node
     8  }
     9  
    10  func (i *Iterator) Value() Element {
    11  	if i.current == nil {
    12  		return nil
    13  	}
    14  	return i.current.value
    15  }
    16  
    17  func (i *Iterator) Next() *Iterator {
    18  	if i.current == nil {
    19  		return nil
    20  	}
    21  	i.current = i.current.next
    22  	return i
    23  }