Documentation
¶
Index ¶
- type IndexError
- type InvalidError
- type Iterator
- type List
- func (list *List[T]) Add(vs ...T)
- func (list *List[T]) Bogo()
- func (list *List[_]) Clear()
- func (list *List[T]) Copy() List[T]
- func (list *List[T]) Delete(v T) bool
- func (list *List[T]) Get(index int) (T, error)
- func (list *List[T]) IndexOf(v T) int
- func (list *List[T]) Insert(index int, vs ...T) error
- func (list *List[T]) InsertList(index int, other *List[T]) error
- func (list *List[_]) Length() int
- func (list *List[T]) Remove(index int) (T, error)
- func (list *List[T]) Search(v T) int
- func (list *List[T]) Set(index int, v T) (T, error)
- func (list *List[T]) Shuffle()
- func (list *List[_]) Sort()
- func (list *List[T]) Sorted() bool
- func (list List[_]) String() string
- func (list *List[T]) Sublist(index int) (*List[T], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IndexError ¶
type IndexError struct {
// contains filtered or unexported fields
}
Index out of bounds error, Implements error interface
type InvalidError ¶
type InvalidError struct {
// contains filtered or unexported fields
}
Invalid operation error, Implements error interface
func (*InvalidError) Error ¶
func (e *InvalidError) Error() string
Return error message for InvalidError
type Iterator ¶
type Iterator[T constraints.Ordered] struct { // contains filtered or unexported fields }
Iterator for efficient traversal of linked list
type List ¶
type List[T constraints.Ordered] struct { // contains filtered or unexported fields }
List represents a singly-linked list that holds values of ordered type (string, int, float), Implements Stringer interface
func (*List[T]) InsertList ¶
Insert list at index
func (*List[T]) Search ¶
Binary search for v (inefficient in linked list), List must be sorted, Return index, or (-insertion point-1) if not found
Click to show internal directories.
Click to hide internal directories.