type Element … // Next returns the next list element or nil. func (e *Element) Next() *Element { … } // Prev returns the previous list element or nil. func (e *Element) Prev() *Element { … } type List … // Init initializes or clears list l. func (l *List) Init() *List { … } // New returns an initialized list. func New() *List { … } // Len returns the number of elements of list l. // The complexity is O(1). func (l *List) Len() int { … } // Front returns the first element of list l or nil if the list is empty. func (l *List) Front() *Element { … } // Back returns the last element of list l or nil if the list is empty. func (l *List) Back() *Element { … } // lazyInit lazily initializes a zero List value. func (l *List) lazyInit() { … } // insert inserts e after at, increments l.len, and returns e. func (l *List) insert(e, at *Element) *Element { … } // insertValue is a convenience wrapper for insert(&Element{Value: v}, at). func (l *List) insertValue(v any, at *Element) *Element { … } // remove removes e from its list, decrements l.len func (l *List) remove(e *Element) { … } // move moves e to next to at. func (l *List) move(e, at *Element) { … } // Remove removes e from l if e is an element of list l. // It returns the element value e.Value. // The element must not be nil. func (l *List) Remove(e *Element) any { … } // PushFront inserts a new element e with value v at the front of list l and returns e. func (l *List) PushFront(v any) *Element { … } // PushBack inserts a new element e with value v at the back of list l and returns e. func (l *List) PushBack(v any) *Element { … } // InsertBefore inserts a new element e with value v immediately before mark and returns e. // If mark is not an element of l, the list is not modified. // The mark must not be nil. func (l *List) InsertBefore(v any, mark *Element) *Element { … } // InsertAfter inserts a new element e with value v immediately after mark and returns e. // If mark is not an element of l, the list is not modified. // The mark must not be nil. func (l *List) InsertAfter(v any, mark *Element) *Element { … } // MoveToFront moves element e to the front of list l. // If e is not an element of l, the list is not modified. // The element must not be nil. func (l *List) MoveToFront(e *Element) { … } // MoveToBack moves element e to the back of list l. // If e is not an element of l, the list is not modified. // The element must not be nil. func (l *List) MoveToBack(e *Element) { … } // MoveBefore moves element e to its new position before mark. // If e or mark is not an element of l, or e == mark, the list is not modified. // The element and mark must not be nil. func (l *List) MoveBefore(e, mark *Element) { … } // MoveAfter moves element e to its new position after mark. // If e or mark is not an element of l, or e == mark, the list is not modified. // The element and mark must not be nil. func (l *List) MoveAfter(e, mark *Element) { … } // PushBackList inserts a copy of another list at the back of list l. // The lists l and other may be the same. They must not be nil. func (l *List) PushBackList(other *List) { … } // PushFrontList inserts a copy of another list at the front of list l. // The lists l and other may be the same. They must not be nil. func (l *List) PushFrontList(other *List) { … }