Private headPrivate tailAdds an element to the end of the list. This is an alias for addLast.
The value to add
Adds an element to the beginning of the list.
The value to add
Adds an element to the end of the list. This is O(1) due to the tail pointer.
The value to add
Checks if the list contains a specific value.
The value to search for
True if the value exists in the list, false otherwise
Returns the element at the specified index.
The index of the element to retrieve
The element at the specified index
Error if the list is empty or index is out of bounds
TODO: Start at head or tail based on index compared to size for better performance
Returns the index of the first occurrence of the specified value.
The value to search for
The index of the value, or -1 if not found
Replaces the element at the specified index with a new value.
The index of the element to replace
The new value
The previous value at the specified index
Error if the index is out of bounds
TODO: Start at head or tail based on index compared to size for better performance
A doubly linked list data structure. Each element has pointers to both the next and previous elements, allowing bidirectional traversal.
Typeparam
T - The type of elements stored in the list