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