front method
Retrieves the first element of the list. Throws a StateError if the list is empty.
Implementation
T front() {
if (_head == null) {
throw StateError('Cannot get front of an empty ForwardList');
}
return _head!.value;
}
Retrieves the first element of the list. Throws a StateError if the list is empty.
T front() {
if (_head == null) {
throw StateError('Cannot get front of an empty ForwardList');
}
return _head!.value;
}