Chromium Code Reviews| 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>>*/( |
|
abarth
2016/03/26 07:13:23
This change isn't correct. The arguments to this
|
| + List/*<T>*/ sortedList, /*=T*/ value, { int compare(/*=T*/ a, /*=T*/ b) }) { |
| if (compare == null) { |
| return _comparableLowerBound(sortedList, value); |
| } |