Skip to content

Commit ff65005

Browse files
committed
Remove deprecated declarations.
Keep `.whereNotNull`. It's deprecation is fairly new. Deprecate `IterableZip` in anticipation of getting `.zip` in the platform libraries.
1 parent 2a436d5 commit ff65005

14 files changed

+20
-309
lines changed

pkgs/collection/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 2.0.0
2+
3+
- Breaking changes:
4+
- Adds `final`, `base` and `interface` to classes intended to be so.
5+
- Removes deprecated declarations. Most has been replaced by functionality
6+
in the platform libraries, or better functionality in other libraries.
7+
- Removes deprecated top-level libraries.
8+
Implement `package:collection/collection.dart` and use `show` or `hide`
9+
to control the imported names if necessary, or desired.
10+
111
## 1.19.1
212

313
- Move to `dart-lang/core` monorepo.

pkgs/collection/lib/algorithms.dart

Lines changed: 0 additions & 10 deletions
This file was deleted.

pkgs/collection/lib/equality.dart

Lines changed: 0 additions & 9 deletions
This file was deleted.

pkgs/collection/lib/iterable_zip.dart

Lines changed: 0 additions & 9 deletions
This file was deleted.

pkgs/collection/lib/priority_queue.dart

Lines changed: 0 additions & 9 deletions
This file was deleted.

pkgs/collection/lib/src/canonicalized_map.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ class CanonicalizedMap<C, K, V> implements Map<K, V> {
156156
void removeWhere(bool Function(K key, V value) test) =>
157157
_base.removeWhere((_, pair) => test(pair.key, pair.value));
158158

159-
@Deprecated('Use cast instead')
160-
Map<K2, V2> retype<K2, V2>() => cast<K2, V2>();
161-
162159
@override
163160
V update(K key, V Function(V) update, {V Function()? ifAbsent}) =>
164161
_base.update(_canonicalize(key), (pair) {

pkgs/collection/lib/src/comparators.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ int compareAsciiLowerCase(String a, String b) {
151151
/// ordering, where lexical ordering would put the `1` before the `7`, ignoring
152152
/// that the `1` is part of a larger number.
153153
///
154+
/// If a digit sequence differs only in the number of leading zeros,
155+
/// and therefore have the same numerical value, the one with
156+
/// fewer leading zeros is ordered before the one with more.
157+
///
158+
/// Numbers are unsigned. A prior `-` is not considered a minus sign.
159+
///
154160
/// Example:
155161
/// The following strings are in the order they would be sorted by using this
156162
/// comparison function:

pkgs/collection/lib/src/empty_unmodifiable_set.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ class EmptyUnmodifiableSet<E> extends IterableBase<E>
2727
Iterable<E> followedBy(Iterable<E> other) => DelegatingIterable(other);
2828
@override
2929
E? lookup(Object? element) => null;
30-
@Deprecated('Use cast instead')
31-
@override
32-
EmptyUnmodifiableSet<T> retype<T>() => EmptyUnmodifiableSet<T>();
3330
@override
3431
E singleWhere(bool Function(E) test, {E Function()? orElse}) =>
3532
orElse != null ? orElse() : throw StateError('No element');

pkgs/collection/lib/src/functions.dart

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,9 @@
55
import 'dart:collection';
66
import 'dart:math' as math;
77

8+
import 'list_extensions.dart' show ListExtensions; // For `reverseRange`.
89
import 'utils.dart';
910

10-
/// Creates a new map from [map] with new keys and values.
11-
///
12-
/// The return values of [key] are used as the keys and the return values of
13-
/// [value] are used as the values for the new map.
14-
@Deprecated('Use Map.map or a for loop in a Map literal.')
15-
Map<K2, V2> mapMap<K1, V1, K2, V2>(Map<K1, V1> map,
16-
{K2 Function(K1, V1)? key, V2 Function(K1, V1)? value}) {
17-
var keyFn = key ?? (mapKey, _) => mapKey as K2;
18-
var valueFn = value ?? (_, mapValue) => mapValue as V2;
19-
20-
var result = <K2, V2>{};
21-
map.forEach((mapKey, mapValue) {
22-
result[keyFn(mapKey, mapValue)] = valueFn(mapKey, mapValue);
23-
});
24-
return result;
25-
}
26-
2711
/// Returns a new map with all key/value pairs in both [map1] and [map2].
2812
///
2913
/// If there are keys that occur in both maps, the [value] function is used to
@@ -109,45 +93,6 @@ S? maxBy<S, T>(Iterable<S> values, T Function(S) orderBy,
10993
return maxValue;
11094
}
11195

112-
/// Returns the [transitive closure][] of [graph].
113-
///
114-
/// [transitive closure]: https://en.wikipedia.org/wiki/Transitive_closure
115-
///
116-
/// Interprets [graph] as a directed graph with a vertex for each key and edges
117-
/// from each key to the values that the key maps to.
118-
///
119-
/// Assumes that every vertex in the graph has a key to represent it, even if
120-
/// that vertex has no outgoing edges. This isn't checked, but if it's not
121-
/// satisfied, the function may crash or provide unexpected output. For example,
122-
/// `{"a": ["b"]}` is not valid, but `{"a": ["b"], "b": []}` is.
123-
@Deprecated('This method will be removed. Consider using package:graphs.')
124-
Map<T, Set<T>> transitiveClosure<T>(Map<T, Iterable<T>> graph) {
125-
// This uses [Warshall's algorithm][], modified not to add a vertex from each
126-
// node to itself.
127-
//
128-
// [Warshall's algorithm]: https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm#Applications_and_generalizations.
129-
var result = <T, Set<T>>{};
130-
graph.forEach((vertex, edges) {
131-
result[vertex] = Set<T>.from(edges);
132-
});
133-
134-
// Lists are faster to iterate than maps, so we create a list since we're
135-
// iterating repeatedly.
136-
var keys = graph.keys.toList();
137-
for (var vertex1 in keys) {
138-
for (var vertex2 in keys) {
139-
for (var vertex3 in keys) {
140-
if (result[vertex2]!.contains(vertex1) &&
141-
result[vertex1]!.contains(vertex3)) {
142-
result[vertex2]!.add(vertex3);
143-
}
144-
}
145-
}
146-
}
147-
148-
return result;
149-
}
150-
15196
/// Returns the [strongly connected components][] of [graph], in topological
15297
/// order.
15398
///
@@ -209,5 +154,5 @@ List<Set<T>> stronglyConnectedComponents<T>(Map<T, Iterable<T>> graph) {
209154

210155
// Tarjan's algorithm produces a reverse-topological sort, so we reverse it to
211156
// get a normal topological sort.
212-
return result.reversed.toList();
157+
return result..reverseRange(0, result.length);
213158
}

pkgs/collection/lib/src/iterable_zip.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'dart:collection';
1313
/// combined into a single list, which becomes the next value of this
1414
/// [Iterable]'s [Iterator]. As soon as any of the iterators run out,
1515
/// the zipped iterator also stops.
16+
@Deprecated('Use [i1, i2].zip from dart:collection')
1617
class IterableZip<T> extends IterableBase<List<T>> {
1718
final Iterable<Iterable<T>> _iterables;
1819

0 commit comments

Comments
 (0)