// Map returns the first element in the stack causing mapFunc returns true.
Map returns the first element in the stack causing mapFunc returns true.
// Map returns the first element in the stack causing mapFunc returns true .
func (s *Stack) Map(mapFunc CallbackFunc) interface{} {
	s.sem <- 1
	e := s.list.Front()
	for e != nil {
		if mapFunc(e.Value) {
			<-s.sem
			return e.Value
		}
		e = e.Next()
	}
	<-s.sem
	return nil
}
func ( s * Stack ) Map ( mapFunc CallbackFunc ) interface { } { s . sem <- 1 e := s . list . Front ( ) for e != nil { if mapFunc ( e . Value ) { <- s . sem return e . Value } e = e . Next ( ) } <- s . sem return nil }
Map returns the first element in the stack causing mapFunc returns true.
Map returns the first element in the stack causing mapFunc returns true .