OLD | NEW |
(Empty) | |
| 1 #Helper libraries for working with collections. |
| 2 |
| 3 The `collection` package contains a number of separate libraries |
| 4 with utility functions and classes that makes working with collections easier. |
| 5 |
| 6 ## Using |
| 7 |
| 8 The `collection` package can be imported as separate libraries, or |
| 9 in totality: |
| 10 |
| 11 import 'package:collection/algorithms.dart'; |
| 12 import 'package:collection/equality.dart'; |
| 13 import 'package:collection/iterable_zip.dart'; |
| 14 import 'package:collection/priority_queue.dart'; |
| 15 import 'package:collection/wrappers.dart'; |
| 16 |
| 17 or |
| 18 |
| 19 import 'package:collection/collection.dart'; |
| 20 |
| 21 ## Algorithms |
| 22 |
| 23 The algorithms library contains functions that operate on lists. |
| 24 |
| 25 It contains ways to shuffle a `List`, do binary search on a sorted `List`, and |
| 26 various sorting algorithms. |
| 27 |
| 28 |
| 29 ## Equality |
| 30 |
| 31 The equality library gives a way to specify equality of elements and |
| 32 collections. |
| 33 |
| 34 Collections in Dart have no inherent equality. Two sets are not equal, even |
| 35 if they contain exactly the same objects as elements. |
| 36 |
| 37 The equality library provides a way to say define such an equality. In this |
| 38 case, for example, `const SetEquality(const IdentityEquality())` is an equality |
| 39 that considers two sets equal exactly if they contain identical elements. |
| 40 |
| 41 The library provides ways to define equalities on `Iterable`s, `List`s, `Set`s, |
| 42 and `Map`s, as well as combinations of these, such as: |
| 43 |
| 44 const MapEquality(const IdentityEquality(), const ListEquality()); |
| 45 |
| 46 This equality considers maps equal if they have identical keys, and the |
| 47 corresponding values are lists with equal (`operator==`) values. |
| 48 |
| 49 |
| 50 ## Iterable Zip |
| 51 |
| 52 Utilities for "zipping" a list of iterables into an iterable of lists. |
| 53 |
| 54 |
| 55 ## Priority Queue |
| 56 |
| 57 An interface and implemention of a priority queue. |
| 58 |
| 59 |
| 60 ## Wrappers |
| 61 |
| 62 The wrappers library contains classes that "wrap" a collection. |
| 63 |
| 64 A wrapper class contains an object of the same type, and it forwards all |
| 65 methods to the wrapped object. |
| 66 |
| 67 Wrapper classes can be used in various ways, for example to restrict the type |
| 68 of an object to that of a supertype, or to change the behavior of selected |
| 69 functions on an existing object. |
| 70 |
| 71 ## Features and bugs |
| 72 |
| 73 Please file feature requests and bugs at the [issue tracker][tracker]. |
| 74 |
| 75 [tracker]: https://github.com/dart-lang/collection/issues |
OLD | NEW |