Documentation
¶
Index ¶
- type LinkedList
- func (l *LinkedList[T]) Clear()
- func (l LinkedList[T]) Contains(val T) bool
- func (l LinkedList[T]) Count() int
- func (l LinkedList[T]) Empty() bool
- func (l LinkedList[T]) First() T
- func (l LinkedList[T]) ForEach(f func(i int, val T))
- func (l LinkedList[T]) Get(index int) T
- func (l *LinkedList[T]) Insert(val T, index int)
- func (l *LinkedList[T]) InsertFirst(val T)
- func (l *LinkedList[T]) InsertLast(val T)
- func (l LinkedList[T]) Last() T
- func (l *LinkedList[T]) Remove(index int)
- func (l *LinkedList[T]) RemoveFirst()
- func (l *LinkedList[T]) RemoveLast()
- func (l *LinkedList[T]) Update(index int, val T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LinkedList ¶
type LinkedList[T comparable] struct { // contains filtered or unexported fields }
LinkedList is the main linked list type.
func (LinkedList[T]) Contains ¶
func (l LinkedList[T]) Contains(val T) bool
Contains returns true if the value exists in the linked list, false if not.
func (LinkedList[T]) Count ¶
func (l LinkedList[T]) Count() int
Count returns the amount of entries in the linked list.
func (LinkedList[T]) Empty ¶
func (l LinkedList[T]) Empty() bool
Empty returns true if the linked list is empty, false if not.
func (LinkedList[T]) First ¶
func (l LinkedList[T]) First() T
First returns the value at the beginning of the linked list.
func (LinkedList[T]) ForEach ¶
func (l LinkedList[T]) ForEach(f func(i int, val T))
ForEach iterates over the dataset within the linked list, calling the passed function for each value.
func (LinkedList[T]) Get ¶
func (l LinkedList[T]) Get(index int) T
Get gets a value at the specified index.
func (*LinkedList[T]) Insert ¶
func (l *LinkedList[T]) Insert(val T, index int)
Insert inserts a value at the specified index.
func (*LinkedList[T]) InsertFirst ¶
func (l *LinkedList[T]) InsertFirst(val T)
InsertFirst inserts a value at the beginning of the linked list.
func (*LinkedList[T]) InsertLast ¶
func (l *LinkedList[T]) InsertLast(val T)
InsertLast inserts a value at the end of the linked list.
func (LinkedList[T]) Last ¶
func (l LinkedList[T]) Last() T
Last returns the value at the end of the linked list.
func (*LinkedList[T]) Remove ¶
func (l *LinkedList[T]) Remove(index int)
Remove removes a value at the specified index.
func (*LinkedList[T]) RemoveFirst ¶
func (l *LinkedList[T]) RemoveFirst()
RemoveFirst removes the first value in the linked list.
func (*LinkedList[T]) RemoveLast ¶
func (l *LinkedList[T]) RemoveLast()
RemoveLast removes the last value in the linked list.
func (*LinkedList[T]) Update ¶
func (l *LinkedList[T]) Update(index int, val T)
Update updates a value at the specified index.