linkedlist

package
v0.0.0-...-a261c41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

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
}

func NewLinkedList

func NewLinkedList[T comparable]() *LinkedList[T]

func (*LinkedList[T]) Add

func (list *LinkedList[T]) Add(item T)

将指定元素添加到列表末尾。

func (*LinkedList[T]) AddAt

func (list *LinkedList[T]) AddAt(index int, item T)

将指定元素插入到列表的指定位置。

func (*LinkedList[T]) Get

func (list *LinkedList[T]) Get(index int) T

返回列表中指定位置的元素。

func (*LinkedList[T]) IsEmpty

func (list *LinkedList[T]) IsEmpty() bool

判断列表是否为空。

func (*LinkedList[T]) Remove

func (list *LinkedList[T]) Remove(index int) bool

删除列表中指定位置的元素。

func (*LinkedList[T]) Set

func (list *LinkedList[T]) Set(index int, item T)

将列表中指定位置的元素替换为指定元素。

func (*LinkedList[T]) Size

func (list *LinkedList[T]) Size() int

返回列表中的元素数量。

func (*LinkedList[T]) String

func (list *LinkedList[T]) String() string

type List

type List[T comparable] struct {
	// contains filtered or unexported fields
}

func (*List[T]) Get

func (list *List[T]) Get(index int) T

返回列表中指定位置的元素。

func (*List[T]) InsertAt

func (list *List[T]) InsertAt(index int, item T)

将指定元素插入到列表的指定位置。

func (*List[T]) IsEmpty

func (list *List[T]) IsEmpty() bool

判断列表是否为空。

func (*List[T]) Len

func (list *List[T]) Len() int

返回列表中的元素数量。

func (*List[T]) PushBack

func (list *List[T]) PushBack(item T)

将指定元素添加到列表末尾。

func (*List[T]) RemoveAt

func (list *List[T]) RemoveAt(index int) bool

删除列表中指定位置的元素。

func (*List[T]) Set

func (list *List[T]) Set(index int, item T)

将列表中指定位置的元素替换为指定元素。

type Node

type Node[T comparable] struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL