Documentation
¶
Index ¶
- type Direction
- type Element
- type List
- func (l *List[T]) Back() *Element[T]
- func (l *List[T]) Front() *Element[T]
- func (l *List[T]) Len() int
- func (l *List[T]) MoveToFront(e *Element[T])
- func (l *List[T]) Next(offset int) (*Element[T], bool)
- func (l *List[T]) NextFromBack(offset int) (*Element[T], bool)
- func (l *List[T]) PopBack() *Element[T]
- func (l *List[T]) PushBack(v T) *Element[T]
- func (l *List[T]) PushFront(v T) *Element[T]
- func (l *List[T]) Remove(e *Element[T])
- func (l *List[T]) Sort(ord Order)
- type Order
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
func (*List[T]) Len ¶
Len returns the number of user elements in the list. Safe for concurrent reads.
func (*List[T]) MoveToFront ¶
MoveToFront moves e to the front (MRU head). No-op if len<2 or already at head.
func (*List[T]) Next ¶
Next returns the element at offset from the front (MRU head). offset=0 -> head. Returns (nil, false) if out of range.
func (*List[T]) NextFromBack ¶ added in v1.3.0
NextFromBack returns the element at offset from the back (LRU tail). offset=0 -> tail. Returns (nil, false) if out of range.
func (*List[T]) PopBack ¶ added in v1.3.0
PopBack removes and returns the last element (LRU tail) or nil if empty. Caller is responsible to eventually return the element to the pool via FreeElement AFTER it has consumed e.Value() (e.g., after removing from external storage/index).
func (*List[T]) PushFront ¶
PushFront inserts v at the front (MRU head) and returns the new element.