LinkedList<E> constructor

LinkedList<E>()

Creates an empty linked list.

A custom implementation of a doubly linked list that implements the standard List<E> interface.

This LinkedList provides all list operations such as insertion, removal, iteration, indexing, and length tracking, but operates using linked nodes rather than a backing array.

⚠️ Note: While all List<E> methods are implemented, operations like random access, sort(), or shuffle() are inherently less efficient due to the sequential nature of linked lists compared to array-based lists.


📦 Example Usage:

final list = LinkedList<String>();
list.add('A');
list.add('B');
list.insert(1, 'X');

print(list); // [A, X, B]
print(list.length); // 3
print(list[2]); // B

Internally, this list is backed by _Node<E> instances that link to their previous and next nodes. This allows efficient insertion and deletion at both ends and in the middle.

Implementation

LinkedList();