double_linked_list
2.0.1, released 5 years ago by an unverified publisher
A generic double linked list data structure for Dart and Flutter.
What it does
Provides a generic double linked list implementation allowing constant time insertions at both ends, before or after any element, and constant time element deletion. It also supports standard Iterable operations and custom extensions for easy list creation.
AI-written summary of version 2.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need constant-time insertions and deletions at arbitrary positions via nodes.
- You require a classic double-linked list data structure in Dart.
Skip it when
- You only need standard Dart lists or queues which are more than sufficient for most use cases.
- You require indexed random access, which is inefficient in a linked list.
Strengths
- Constant time insertions and deletions at both ends and relative to any node.
- Supports many common Iterable methods like map, where, reduce, and fold.
Weaknesses
- Improper iteration while mutating the list can lead to infinite loops if not handled carefully.
- Lacks random access by index.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
import 'package:double_linked_list/double_linked_list.dart';
main() {
final emptyList = DoubleLinkedList<int>.empty();
final fromList = DoubleLinkedList<int>.fromIterable([1, 2, 3]);
final fromListExtension = [1, 2, 3].toDoubleLinkedList();
fromListExtension.forEach(print);
}Alternatives
Packages that do the same job and could replace double_linked_list.
- ordered_set
Ordered Set that keeps elements sorted and allows duplicates by priority.
82Compare - tuple
Provides immutable tuple classes for grouping values.
50Compare - data
Time and space efficient data structures and algorithms for vectors, matrices, and math.
72Compare - intersperse
Insert a given element between each element of an Iterable or List.
50Compare
Works with
Packages commonly used together with double_linked_list: ones it builds on, ones built on it, and its own family.