collection
v1.19.1Collections and utilities functions and classes related to collections.
Package archive: https://pubdev.letsnova.ru/api/archives/collection/1.19.1.tar.gz
dart pub add collectionReadme
Contains utility functions and classes in the style of dart:collection to make
working with collections easier.
Algorithms
The package contains functions that operate on lists.
It contains ways to shuffle a List, do binary search on a sorted List, and
various sorting algorithms.
Equality
The package provides a way to specify the equality of elements and collections.
Collections in Dart have no inherent equality. Two sets are not equal, even if they contain exactly the same objects as elements.
The Equality interface provides a way to define such an equality. In this
case, for example, const SetEquality(IdentityEquality()) is an equality
that considers two sets equal exactly if they contain identical elements.
Equalities are provided for Iterables, Lists, Sets, and Maps, as well as
combinations of these, such as:
const MapEquality(IdentityEquality(), ListEquality());
This equality considers maps equal if they have identical keys, and the
corresponding values are lists with equal (operator==) values.
Iterable Zip
Utilities for "zipping" a list of iterables into an iterable of lists.
Priority Queue
An interface and implementation of a priority queue.
Wrappers
The package contains classes that "wrap" a collection.
A wrapper class contains an object of the same type, and it forwards all methods to the wrapped object.
Wrapper classes can be used in various ways, for example to restrict the type of an object to that of a supertype, or to change the behavior of selected functions on an existing object.
Features and bugs
Please file feature requests and bugs at the issue tracker.
Changelog
1.19.1
- Move to
dart-lang/coremonorepo.
1.19.0
- Adds
shuffledtoIterableExtension. - Shuffle
IterableExtension.sampleresults. - Fix
mergeSortwhen the runtime iterable generic is a subtype of the static generic. CanonicalizedMap: added constructorfromEntries.- Mark "mixin" classes as
mixin. extension IterableIterableExtension<T> on Iterable<Iterable<T>>- Add
flattenedToListas a performance improvement overflattened. - Add
flattenedToSetas new behavior for flattening to unique elements.
- Add
- Deprecate
transitiveClosure. Consider usingpackage:graphs. - Deprecate
whereNotNull()fromIterableNullableExtension. UsenonNullsinstead - this is an equivalent extension available in Dart core since version 3.0. - Require Dart
^3.4.0
1.18.0
CanonicalizedMap:- Added methods:
copy: copies an instance without recalculating the canonical values of the keys.toMap: creates aMap<K,V>(with the original key values).toMapOfCanonicalKeys: creates aMap<C,V>(with the canonicalized keys).
- Added methods:
- Fixes bugs in
ListSlice.sliceandListExtensions.slice. - Update to
package:lints2.0.1.
1.17.2
- Accept Dart SDK versions above 3.0.
1.17.1
- Require Dart 2.18.
- Improve docs for
splitAfterandsplitBefore.
1.17.0
- Add
Iterable.elementAtOrNullandList.elementAtOrNullextension methods. - Add a top-level
lastBy()function that converts anIterableto aMapby grouping its elements using a function, keeping the last element for each computed key. Also available as an extension method onIterable.
1.16.0
- Add an
Iterable.slicesextension method. - Add
BoolListclass for space-efficient lists of boolean values. - Use a stable sort algorithm in the
IterableExtension.sortedBymethod. - Add
min,max,minOrNullandmaxOrNullgetters toIterableDoubleExtension,IterableNumberExtensionandIterableIntegerExtension - Change
UnorderedIterableEqualityandSetEqualityto implementEqualitywith a non-nullable generic to allows assignment to variables with that type. Assignment toEqualitywith a nullable type is still allowed because of covariance. Theequalsandhashmethods continue to accept nullable arguments. - Enable the
avoid_dynamic_callslint.
1.15.0
- Stable release for null safety.
1.15.0-nullsafety.5
- Fix typo in extension method
expandIndexed. - Update sdk constraints to
>=2.12.0-0 <3.0.0based on beta release guidelines.
1.15.0-nullsafety.4
-
Allow prerelease versions of the
2.12.xsdk. -
Remove the unusable setter
UnionSetController.set=. This was mistakenly added to the public API but could never be called. -
Add extra optional
Randomargument toshuffle. -
Add a large number of extension methods on
IterableandListtypes, and on a few other types. These either provide easy access to the operations fromalgorithms.dart, or provide convenience variants of existingIterableandListmethods likesingleWhereOrNullorforEachIndexed.
1.15.0-nullsafety.3
- Allow 2.10 stable and 2.11.0 dev SDK versions.
- Add
toUnorderedListmethod onPriorityQueue. - Make
HeapPriorityQueue'sremoveandcontainsmethods use==for equality checks. Previously usedcomparison(a, b) == 0as criteria, but it's possible to have multiple elements with the same priority in a queue, so that could remove the wrong element. Still requires that objects that are==also have the same priority.
1.15.0-nullsafety.2
Update for the 2.10 dev sdk.
1.15.0-nullsafety.1
- Allow the <=2.9.10 stable sdks.
1.15.0-nullsafety
Pre-release for the null safety migration of this package.
Note that 1.15.0 may not be the final stable null safety release version,
we reserve the right to release it as a 2.0.0 breaking change.
This release will be pinned to only allow pre-release sdk versions starting
from 2.9.0-dev.18.0, which is the first version where this package will
appear in the null safety allow list.
1.14.13
- Deprecate
mapMap. The Map interface has amapcall and map literals can use for-loop elements which supersede this method.
1.14.12
- Fix
CombinedMapView.keys,CombinedMapView.length,CombinedMapView.forEach, andCombinedMapView.valuesto work as specified and not repeat duplicate items from the maps.- As a result of this fix the
lengthgetter now must iterate all maps in order to remove duplicates and return an accurate length, so it is no longerO(maps).
- As a result of this fix the
1.14.11
- Set max SDK version to
<3.0.0.
1.14.10
- Fix the parameter names in overridden methods to match the source.
- Make tests Dart 2 type-safe.
- Stop depending on SDK
retypeand deprecate methods.
1.14.9
- Fixed bugs where
QueueList,MapKeySet, andMapValueSetdid not adhere to the contract laid out byList.cast,Set.castandMap.castrespectively. The returned instances of these methods now correctly forward to the existing instance instead of always creating a new copy.
1.14.8
- Deprecated
Delegating{Name}.typedstatic methods in favor of the new Dart 2castmethods. For example,DelegatingList.typed<String>(list)can now be written aslist.cast<String>().
1.14.7
- Only the Dart 2 dev SDK (
>=2.0.0-dev.22.0) is now supported. - Added support for all Dart 2 SDK methods that threw
UnimplementedError.
1.14.6
-
Make
DefaultEquality'sequals()andhash()methods take anyObjectrather than objects of typeE. This makesconst DefaultEquality<Null>()usable asEquality<E>for anyE, which means it can be used in a const context which expectsEquality<E>.This makes the default arguments of various other const equality constructors work in strong mode.
1.14.5
- Fix issue with
EmptyUnmodifiableSet's stubs that were introduced in 1.14.4.
1.14.4
- Add implementation stubs of upcoming Dart 2.0 core library methods, namely
new methods for classes that implement
Iterable,List,Map,Queue, andSet.
1.14.3
- Fix
MapKeySet.lookupto be a valid override in strong mode.
1.14.2
- Add type arguments to
SyntheticInvocation.
1.14.1
- Make
Equalityimplementations acceptnullas argument tohash.
1.14.0
- Add
CombinedListView, a view of several lists concatenated together. - Add
CombinedIterableView, a view of several iterables concatenated together. - Add
CombinedMapView, a view of several maps concatenated together.
1.13.0
- Add
EqualityBy
1.12.0
-
Add
CaseInsensitiveEquality. -
Fix bug in
equalsIgnoreAsciiCase.
1.11.0
- Add
EqualityMapandEqualitySetclasses which useEqualityobjects for key and element equality, respectively.
1.10.1
Set.differencenow takes aSet<Object>as argument.
1.9.1
- Fix some documentation bugs.
1.9.0
- Add a top-level
stronglyConnectedComponents()function that returns the strongly connected components in a directed graph.
1.8.0
-
Add a top-level
mapMap()function that works likeIterable.map()on aMap. -
Add a top-level
mergeMaps()function that creates a new map with the combined contents of two existing maps. -
Add a top-level
groupBy()function that converts anIterableto aMapby grouping its elements using a function. -
Add top-level
minBy()andmaxBy()functions that return the minimum and maximum values in anIterable, respectively, ordered by a derived value. -
Add a top-level
transitiveClosure()function that returns the transitive closure of a directed graph.
1.7.0
- Add a
const UnmodifiableSetView.empty()constructor.
1.6.0
-
Add a
UnionSetclass that provides a view of the union of a set of sets. -
Add a
UnionSetControllerclass that provides a convenient way to manage the contents of aUnionSet. -
Fix another incorrectly-declared generic type.
1.5.1
- Fix an incorrectly-declared generic type.
1.5.0
-
Add
DelegatingIterable.typed(),DelegatingList.typed(),DelegatingSet.typed(),DelegatingMap.typed(), andDelegatingQueue.typed()static methods. These wrap untyped instances of these classes with the correct type parameter, and assert the types of values as they're accessed. -
Fix the types for
binarySearch()andlowerBound()so they no longer require all arguments to be comparable. -
Add generic annotations to
insertionSort()andmergeSort().
1.4.1
- Fix all strong mode warnings.
1.4.0
-
Add a
new PriorityQueue()constructor that forwards tonew HeapPriorityQueue(). -
Deprecate top-level libraries other than
package:collection/collection.dart, which exports these libraries' interfaces.
1.3.0
-
Add
lowerBoundto binary search for values that might not be present. -
Verify that the is valid for
CanonicalMap.[].
1.2.0
- Add string comparators that ignore ASCII case and sort numbers numerically.
1.1.3
- Fix type inconsistencies with
MapandSet.
1.1.2
- Export
UnmodifiableMapViewfrom the Dart core libraries.
1.1.1
- Bug-fix for signatures of
isValidKeyarguments ofCanonicalizedMap.
1.1.0
- Add a
QueueListclass that implements bothQueueandList.
0.9.4
- Add a
CanonicalizedMapclass that canonicalizes its keys to provide a custom equality relation.
0.9.3+1
- Fix all analyzer hints.
0.9.3
-
Add a
MapKeySetclass that exposes an unmodifiableSetview of aMap's keys. -
Add a
MapValueSetclass that takes a function from values to keys and uses it to expose aSetview of aMap's values.
