OLD | NEW |
1 Helper libraries for working with collections. | 1 Deprecated helper libraries for working with collections. |
2 | 2 |
3 The `collection_helpers` package contains a number of separate libraries | 3 The `collection_helpers` package has been split into the |
4 with utility functions and classes that makes working with collections easier. | 4 `collection` package (for most of the library) |
| 5 and the `typed_data` package (for typed data buffers). |
5 | 6 |
6 ## Using | 7 All further development will happen on those libraries. |
7 | 8 |
8 The `collection_helpers` library can be imported as separate libraries, or | 9 Please start using those libraries directly. |
9 in totality: | |
10 | |
11 import 'package:collection_helpers/equality.dart'; | |
12 import 'package:collection_helpers/algorithms.dart'; | |
13 import 'package:collection_helpers/wrappers.dart'; | |
14 | |
15 or | |
16 | |
17 import 'package:collection_helpers/all.dart'; | |
18 | |
19 ## Equality | |
20 | |
21 The equality library gives a way to specify equality of elements and | |
22 collections. | |
23 | |
24 Collections in Dart have no inherent equality. Two sets are not equal, even | |
25 if they contain exactly the same objects as elements. | |
26 | |
27 The equality library provides a way to say define such an equality. In this | |
28 case, for example, `const SetEquality(const IdentityEquality())` is an equality | |
29 that considers two sets equal exactly if they contain identical elements. | |
30 | |
31 The library provides ways to define equalities on `Iterable`s, `List`s, `Set`s,
and | |
32 `Map`s, as well as combinations of these, such as: | |
33 | |
34 const MapEquality(const IdentityEquality(), const ListEquality()); | |
35 | |
36 This equality considers maps equal if they have identical keys, and the correspo
nding values are lists with equal (`operator==`) values. | |
37 | |
38 ## Algorithms | |
39 | |
40 The algorithms library contains functions that operate on lists. | |
41 | |
42 It contains ways to shuffle a `List`, do binary search on a sorted `List`, and | |
43 some different sorting algorithms. | |
44 | |
45 | |
46 ## Wrappers | |
47 | |
48 The wrappers library contains classes that "wrap" a collection. | |
49 | |
50 A wrapper class contains an object of the same type, and it forwards all | |
51 methods to the wrapped object. | |
52 | |
53 Wrapper classes can be used in various ways, for example to restrict the type | |
54 of an object to that of a supertype, or to change the behavior of selected | |
55 functions on an existing object. | |
OLD | NEW |