Documentation / base / List
Class: List<T>
Defined in: libs/base/src/linkedlist.ts:145
The double list class
Type Parameters
T
T = unknown
The data type associated with the linked list class
Constructors
Constructor
new List<
T>():List<T>
Defined in: libs/base/src/linkedlist.ts:150
Returns
List<T>
Accessors
length
Get Signature
get length():
number
Defined in: libs/base/src/linkedlist.ts:163
Get the number of elements in the linked list
Returns
number
The number of elements in the linked list
Methods
clear()
clear():
void
Defined in: libs/base/src/linkedlist.ts:169
Remove all elements in the linked list
Returns
void
append()
append(
data):ListIterator<T>
Defined in: libs/base/src/linkedlist.ts:182
Append an element to the end of the linked list
Parameters
data
T
The data associated to the element
Returns
ListIterator<T>
An iterator pointing to the newly added element
prepend()
prepend(
data):ListIterator<T>
Defined in: libs/base/src/linkedlist.ts:193
Add a new element to the linked list header
Parameters
data
T
The data associated to the element
Returns
ListIterator<T>
An iterator pointing to the newly added element
remove()
remove(
it):void
Defined in: libs/base/src/linkedlist.ts:203
Deletes an element from the linked list
Parameters
it
ListIterator<T>
An iterator pointing to the element that needs to be removed
Returns
void
insert()
insert(
data,at):ListIterator<T>
Defined in: libs/base/src/linkedlist.ts:218
Inserts an element into the linked list
Parameters
data
T
The data to be inserted to the list
at
ListIterator<T>
An iterator pointing to the element at the insert position
Returns
ListIterator<T>
An iterator pointing to the element that was inserted
forEach()
forEach(
callback):void
Defined in: libs/base/src/linkedlist.ts:238
Execute the callback function sequentially for each element of the linked list
Parameters
callback
(data) => void
The function to be executed
Returns
void
forEachReverse()
forEachReverse(
callback):void
Defined in: libs/base/src/linkedlist.ts:251
Execute the callback function sequentially for each element of the linked list in the reversed order
Parameters
callback
(data) => void
The function to be executed
Returns
void
front()
front():
T
Defined in: libs/base/src/linkedlist.ts:266
Gets the data associated to the first element in the linked list
Returns
T
The data associated to the first element in the linked list
The exception is thrown if the list is empty
back()
back():
T
Defined in: libs/base/src/linkedlist.ts:280
Gets the data associated to the last element in the linked list
Returns
T
The data associated to the last element in the linked list
The exception is thrown if the list is empty
begin()
begin():
ListIterator<T>
Defined in: libs/base/src/linkedlist.ts:292
Returns an iterator pointing to the first element in the list.
Returns
ListIterator<T>
An iterator to the beginning of the list.
end()
end():
ListIterator<T>
Defined in: libs/base/src/linkedlist.ts:301
Returns an iterator referring to the past-the-end element in the list.
Returns
ListIterator<T>
An iterator to the element past the end of the list.
rbegin()
rbegin():
ListIterator<T>
Defined in: libs/base/src/linkedlist.ts:310
Returns a reverse iterator pointing to the last element in the list (i.e., its reverse beginning).
Returns
ListIterator<T>
A reverse iterator to the reverse beginning of the list.
rend()
rend():
ListIterator<T>
Defined in: libs/base/src/linkedlist.ts:319
Returns a reverse iterator pointing to the theoretical element preceding the first element in the list (which is considered its reverse end).
Returns
ListIterator<T>
A reverse iterator to the reverse end of the list.