// PositionInList returns the position of an element in the list.
// If the element was not found, -1 is returned.
PositionInList returns the position of an element in the list.
If the element was not found, -1 is returned.
// PositionInList returns the position of an element in the list . // If the element was not found - 1 is returned .
func PositionInList(l *list.List, elem *list.Element) int {
	if l == nil || l.Front() == nil || elem == nil {
		return -1
	}
	var i int
	e := l.Front()
	for e != l.Back() {
		if e == elem {
			return i
		}
		i++
		e = e.Next()
	}
	if e == elem {
		return i
	}
	return -1
}
func PositionInList ( l * list . List , elem * list . Element ) int { if l == nil || l . Front ( ) == nil || elem == nil { return - 1 } var i int e := l . Front ( ) for e != l . Back ( ) { if e == elem { return i } i ++ e = e . Next ( ) } if e == elem { return i } return - 1 }
PositionInList returns the position of an element in the list.
PositionInList returns the position of an element in the list .