Object -
streams
:
LinkedList
The LinkedList
object which represents the linked list data structure.
Methods
Checks if the linked list is empty.
Moves the cursoer to the front/head of the linked list.
Moves the cursor to the end of the linked list if the cursor is not already at the last element of the linked list.
Returns true if the linked list has more elements starting from the current cursor location.
Returns true
if there are prior elements to the current element/cursor location, otherwise false.
Returns the next element of the linked list and moves the cursor to the next element.
Returns the previous element of the linked list and moves the cursor to the previous element.
Removes the element at the current cursor location.
Returns the current number of elements in the linked list.
Empties the linked list.
Removes the first occurence of the element pass as elem
and return true
of the removal is successful.
Removes the first occurence of the element pass as elem
and return true
of the removal is successful.
Returns the first element of the linked list, without moving the cursor.
Returns the last element of the linked list, without moving the cursor.
Adds a new element to the front of the linked list without moving the cursor.
Adds a new element to the end of the linked list without moving the cursor.
Removes the first element in the linked list without moving the cursor.
Removes the last element in the linked list without moving the cursor.
Insert a new element before the current cursor location.
Returns the first element which is added to the linked list.
Creates an array from the elements in the linked list and return it. The cursor will not be changed.
Adds elements of an array to the current cursor location and moves the cursor to the end of the list.
Fields
Checks if the linked list is empty.
-
Return Type
(boolean) Returns
true
if the linked list is empty, otherwise returnsfalse
.
Moves the cursor to the end of the linked list if the cursor is not already at the last element of the linked list.
Returns true if the linked list has more elements starting from the current cursor location.
-
Return Type
(boolean) Returns
true
if there are more elements onwards from the current cursor location, otherwisefalse
.
Returns true
if there are prior elements to the current element/cursor location, otherwise false.
-
Return Type
(boolean) Returns true, if there are elements prior to the current cursor location, otherwise
false
.
Returns the next element of the linked list and moves the cursor to the next element.
-
Return Type
(any) The next element from the current cursor location.
Returns the previous element of the linked list and moves the cursor to the previous element.
-
Return Type
(any) The previous element from the current cursor location.
Returns the current number of elements in the linked list.
-
Return Type
(int) The number of elements in the linked list.
Removes the first occurence of the element pass as elem
and return true
of the removal is successful.
Parameters
- elem any
-
the element to be removed
-
Return Type
(boolean) Return
true
if removal is successful otherwisefalse
.
Removes the first occurence of the element pass as elem
and return true
of the removal is successful.
Parameters
- elem any
-
the element to be removed
-
Return Type
(boolean) Return
true
if removal is successful otherwisefalse
.
Returns the first element of the linked list, without moving the cursor.
-
Return Type
(any) First element of the linked list.
Returns the last element of the linked list, without moving the cursor.
-
Return Type
(any) Last element of the linked list.
Adds a new element to the front of the linked list without moving the cursor.
Parameters
- data any
-
Data to be added to the front of the linked list.
Adds a new element to the end of the linked list without moving the cursor.
Parameters
- data any
-
Data to be added to the end of the linked list.
Removes the first element in the linked list without moving the cursor.
-
Return Type
(any) Returns the removed element.
Removes the last element in the linked list without moving the cursor.
-
Return Type
(any) Returns the removed element.
Insert a new element before the current cursor location.
Parameters
- data any
-
Data to be inserted.
Returns the first element which is added to the linked list.
-
Return Type
(any) The dequeued element.
Creates an array from the elements in the linked list and return it. The cursor will not be changed.
-
Return Type
(any) An array of elements in the linked list.