链表存储的元素类型 / Type of elements stored in the linked list
链表存储的元素类型 / Type of elements stored in the linked list
检查链表是否为空 / Check if the linked list is empty
如果链表为空返回true,否则返回false / Returns true if the linked list is empty, otherwise false
获取链表的长度 / Get the size of the linked list
链表中元素的数量 / Number of elements in the linked list
迭代器方法,支持for...of循环 / Iterator method, supports for...of loop
获取链表最后一个元素的值 / Get the value of the last element in the linked list
如果链表不为空返回最后一个元素的值,否则返回undefined / Returns the value of the last element if list is not empty, otherwise undefined
清空链表 / Clear the linked list
清空链表并依次产出所有节点值 Empties the linked list and yields all node values in sequence
获取链表第一个元素的值 / Get the value of the first element in the linked list
如果链表不为空返回第一个元素的值,否则返回undefined / Returns the value of the first element if list is not empty, otherwise undefined
获取指定索引的元素值 / Get the element value at specified index
要获取的索引位置 / Index position to get
如果索引有效返回元素值,否则返回undefined / Returns the element value if index is valid, otherwise undefined
在指定索引位置插入元素 / Insert an element at specified index position
要插入的索引位置 / Index position to insert
要插入的值 / Value to insert
如果插入成功返回true,否则返回false / Returns true if inserted successfully, otherwise false
移除并返回链表最后一个元素 / Remove and return the last element of the linked list
如果链表不为空返回被移除的元素值,否则返回undefined / Returns the removed element value if list is not empty, otherwise undefined
在链表尾部添加元素 / Add an element to the end of the linked list
要添加的值 / Value to add
返回链表实例以支持链式调用 / Returns the linked list instance for method chaining
移除指定索引位置的元素 / Remove the element at specified index position
要移除的索引位置 / Index position to remove
如果移除成功返回true,否则返回false / Returns true if removed successfully, otherwise false
反转链表 / Reverse the linked list
返回反转后的链表实例 / Returns the reversed linked list instance
设置指定索引的元素值 / Set the element value at specified index
要设置的索引位置 / Index position to set
要设置的新值 / New value to set
如果设置成功返回true,否则返回false / Returns true if set successfully, otherwise false
移除并返回链表第一个元素 / Remove and return the first element of the linked list
如果链表不为空返回被移除的元素值,否则返回undefined / Returns the removed element value if list is not empty, otherwise undefined
在链表头部添加元素 / Add an element to the beginning of the linked list
要添加的值 / Value to add
返回链表实例以支持链式调用 / Returns the linked list instance for method chaining
链表类 / Linked List Class 实现一个通用的单向链表数据结构 / Implements a generic linked list data structure