Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Unified Diff: lib/src/algorithms.dart

Issue 1817463002: Finish @nex3's strong-mode fixes in package:collection and test it in Travis (Closed) Base URL: https://github.com/ochafik/collection.git@master
Patch Set: revert _throw (now generic) Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/src/algorithms.dart
diff --git a/lib/src/algorithms.dart b/lib/src/algorithms.dart
index 2b66d7df7014cfe921afa2592d5b447e0dc6ed2a..57456a0352f9375ece91872ebb4640d5ee453897 100644
--- a/lib/src/algorithms.dart
+++ b/lib/src/algorithms.dart
@@ -5,7 +5,8 @@
import "dart:math" as math;
/// Version of [binarySearch] optimized for comparable keys
-int _comparableBinarySearch(List<Comparable> list, Comparable value) {
+int _comparableBinarySearch/*<T extends Comparable<T>>*/(
+ List<Comparable/*<T>*/> list, Comparable/*<T>*/ value) {
int min = 0;
int max = list.length;
while (min < max) {
@@ -31,7 +32,8 @@ int _comparableBinarySearch(List<Comparable> list, Comparable value) {
/// the objects.
///
/// Returns -1 if [value] is not in the list by default.
-int binarySearch(List sortedList, value, { int compare(a, b) }) {
+int binarySearch/*<T extends Comparable<T>>*/(
+ List/*<T>*/ sortedList, /*=T*/ value, { int compare(/*=T*/ a, /*=T*/ b) }) {
if (compare == null) {
return _comparableBinarySearch(sortedList, value);
}
@@ -79,7 +81,8 @@ int _comparableLowerBound(List<Comparable> list, Comparable value) {
///
/// Returns [sortedList.length] if all the items in [sortedList] compare less
/// than [value].
-int lowerBound(List sortedList, value, { int compare(a, b) }) {
+int lowerBound/*<T extends Comparable<T>>*/(
+ List/*<T>*/ sortedList, /*=T*/ value, { int compare(/*=T*/ a, /*=T*/ b) }) {
if (compare == null) {
return _comparableLowerBound(sortedList, value);
}

Powered by Google App Engine
This is Rietveld 408576698