Documentation
¶
Index ¶
- type List
- func (l *List[T]) Back() *ListEntry[T]
- func (l *List[T]) Front() *ListEntry[T]
- func (l *List[T]) IterateEntries(fn func(*ListEntry[T]) bool) bool
- func (l *List[T]) IterateValues(fn func(T) bool) bool
- func (l *List[T]) Length() uint
- func (l *List[T]) PushBack(value T) *ListEntry[T]
- func (l *List[T]) PushFront(value T) *ListEntry[T]
- type ListEntry
- type UniqueList
- func (l *UniqueList[T]) Back() *UniqueListEntry[T]
- func (l *UniqueList[T]) Front() *UniqueListEntry[T]
- func (l *UniqueList[T]) Get(value T) *UniqueListEntry[T]
- func (l *UniqueList[T]) IterateEntries(fn func(*UniqueListEntry[T]) bool) bool
- func (l *UniqueList[T]) IterateValues(fn func(T) bool) bool
- func (l *UniqueList[T]) Length() uint
- func (l *UniqueList[T]) PushBack(value T) *UniqueListEntry[T]
- func (l *UniqueList[T]) PushFront(value T) *UniqueListEntry[T]
- func (l *UniqueList[T]) Remove(value T)
- type UniqueListEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List[T any] struct { // contains filtered or unexported fields }
func (*List[T]) IterateEntries ¶
IterateEntries will call fn for each entry in the list, starting from the front. If fn returns false the iteration terminates and Iterate will return false, else it will return true. It is safe to remove the entry passed to fn.
func (*List[T]) IterateValues ¶
IterateValues will call fn for each entry in the list, starting from the front. If fn returns false the iteration terminates and IterateValues will return false, else it will return true. It is safe to remove the entry corresponding to the value passed to fn.
type ListEntry ¶
type ListEntry[T any] struct { // contains filtered or unexported fields }
func (*ListEntry[T]) Next ¶
Next returns the next entry in the list after the specified entry if there is a next entry, else it returns nil.
func (*ListEntry[T]) Previous ¶
Previous returns the previous entry in the list before the specified if there is a previous entry, else it returns nil.
type UniqueList ¶
type UniqueList[T comparable] struct { // contains filtered or unexported fields }
func NewUnique ¶
func NewUnique[T comparable]() *UniqueList[T]
NewUnique creates a linked list of unique entries.
func (*UniqueList[T]) Back ¶
func (l *UniqueList[T]) Back() *UniqueListEntry[T]
Back returns the last entry in the list if there is an entry, else nil.
func (*UniqueList[T]) Front ¶
func (l *UniqueList[T]) Front() *UniqueListEntry[T]
Front returns the first entry in the list if there is an entry, else nil.
func (*UniqueList[T]) Get ¶
func (l *UniqueList[T]) Get(value T) *UniqueListEntry[T]
Get returns the list entry for the specified value if present, else nil.
func (*UniqueList[T]) IterateEntries ¶
func (l *UniqueList[T]) IterateEntries(fn func(*UniqueListEntry[T]) bool) bool
IterateEntries will call fn for each entry in the list, starting from the front. If fn returns false the iteration terminates and IterateEntries will return false, else it will return true. It is safe to remove the entry passed to fn.
func (*UniqueList[T]) IterateValues ¶
func (l *UniqueList[T]) IterateValues(fn func(T) bool) bool
IterateValues will call fn for each entry in the list, starting from the front. If fn returns false the iteration terminates and IterateValues will return false, else it will return true. It is safe to remove the entry corresponding to the value passed to fn.
func (*UniqueList[T]) Length ¶
func (l *UniqueList[T]) Length() uint
Length returns the number of entries in the list.
func (*UniqueList[T]) PushBack ¶
func (l *UniqueList[T]) PushBack(value T) *UniqueListEntry[T]
PushBack adds/moves the value to the back of the list. It returns the list entry.
func (*UniqueList[T]) PushFront ¶
func (l *UniqueList[T]) PushFront(value T) *UniqueListEntry[T]
PushFont adds/moves the value to the front of the list. It returns the list entry.
func (*UniqueList[T]) Remove ¶
func (l *UniqueList[T]) Remove(value T)
Remove removes the entry with the corresponding value from the list.
type UniqueListEntry ¶
type UniqueListEntry[T comparable] struct { // contains filtered or unexported fields }
func (*UniqueListEntry[T]) Next ¶
func (e *UniqueListEntry[T]) Next() *UniqueListEntry[T]
Next returns the next entry in the list after the specified entry if there is a next entry, else it returns nil.
func (*UniqueListEntry[T]) Previous ¶
func (e *UniqueListEntry[T]) Previous() *UniqueListEntry[T]
Previous returns the previous entry in the list before the specified if there is a previous entry, else it returns nil.
func (*UniqueListEntry[T]) Remove ¶
func (e *UniqueListEntry[T]) Remove()
Remove removes the entry from the list it belongs to.
func (*UniqueListEntry[T]) Value ¶
func (e *UniqueListEntry[T]) Value() T
Value returns the value for the entry.