identical_items_list 1.0.0
identical_items_list: ^1.0.0 copied to clipboard
Efficient representation of a non-empty list with identical items. Provides a matching iterable and iterator.
Identical Items List #
Introduction #
The package identical_items_list
provides
a non-empty unmodifiable Dart list containing identical
items. The list is unmodifiable in the sense that object mutating methods
are not implemented. IdenticalItemsList
implements the interface
List<E>
without using an underlying collection.
Usage #
To use this library include identical_items_list
as a dependency in your pubspec.yaml file.
import 'package:identical_items_list/identical_items_list.dart';
void main(List<String> args) {
// Creating an IdentialItemsList
final list = IdenticalItemsList(value: 42, length: 10);
// Creating an IdenticalItemsIterator
final it = list.iterator;
int index = 0;
// Iterating
while (it.moveNext()) {
print('${index++}: ${it.current}');
}
}
}
Click to show the console output.
$ dart example/bin/iterator_example.dart
0: 42
1: 42
2: 42
3: 42
4: 42
5: 42
6: 42
7: 42
8: 42
9: 42
Features and bugs #
Please file feature requests and bugs at the issue tracker.