ILinkedList
Interface | Source Code
Properties
Section titled “Properties”first: undefined | T1
Section titled “first: undefined | T1”The first value in the linked list, or undefined if the list is empty.
head: undefined | ILinkedListNode
Section titled “head: undefined | ILinkedListNode”The first node in the linked list, undefined if the list is empty.
isEmpty: boolean
Section titled “isEmpty: boolean”Whether the linked list is empty.
last: undefined | T1
Section titled “last: undefined | T1”The last value in the linked list, or undefined if the list is empty.
length: number
Section titled “length: number”The number of elements in the linked list.
tail: ILinkedList
Section titled “tail: ILinkedList”The linked list with the head removed. The head of the linked list retrieved this way is equivalent to
head.next.
tip: undefined | ILinkedListNode
Section titled “tip: undefined | ILinkedListNode”The last node in the linked list, undefined if the list is empty.
Methods
Section titled “Methods”add(value: T1): void
Section titled “add(value: T1): void”Adds the specified value to the end of the linked list.
clear(): void
Section titled “clear(): void”Clears the list, emptying it entirely.
filter(predicate: Function): ILinkedList
Section titled “filter(predicate: Function): ILinkedList”Filters the linked list based on the prvoided predicate.
Returns
Section titled “Returns”A new linked list with the elements that passed the test of the provided predicate.
find(predicate: Function): undefined | T1
Section titled “find(predicate: Function): undefined | T1”Finds the element that passes the provided predicate.
Returns
Section titled “Returns”The element that passed the provided predicate, undefined if no element passed.
forEach(iteratee: Function): void
Section titled “forEach(iteratee: Function): void”Iterates over every element in the linked list.
includes(value: T1): boolean
Section titled “includes(value: T1): boolean”Searches the linked list for the specified value.
Returns
Section titled “Returns”Whether the specified value exists in the linked list.
map(iteratee: Function): ILinkedList
Section titled “map(iteratee: Function): ILinkedList”Generates a new linked list by iterating over each element and invoking the provided iteratee. The type of the generated linked list depends on the type of the value returned by the iteratee.
Returns
Section titled “Returns”A new linked list comprised of all values collectively returned from individual invocations of the provided iteratee.
prepend(value: T1): void
Section titled “prepend(value: T1): void”Adds the specified value to the front of the linked list.
remove(value: T1): void
Section titled “remove(value: T1): void”Removes the specified value from the linked list.
removeBy(predicate: Function): void
Section titled “removeBy(predicate: Function): void”Removes the first element that passes the test of the passed predicate.
removeFirst(): void
Section titled “removeFirst(): void”Removes the first value from the linked list.
removeLast(): void
Section titled “removeLast(): void”Removes the final value from the linked list.
some(predicate: Function): boolean
Section titled “some(predicate: Function): boolean”Goes through the elements in the linked list and tests them with the provided predicate.
Returns
Section titled “Returns”Whether any element in the array passed the test specified by the provided predicate.
toArray(): T1[]
Section titled “toArray(): T1[]”Returns
Section titled “Returns”The linked list as an array.
toString(): string
Section titled “toString(): string”Returns
Section titled “Returns”The linked list as a human-readable string.