@@ -322,15 +322,16 @@ Set<String> createDirectoryFilter(Iterable<String> dirs) {
322322/// Returns the maximum value in [iter] by [compare] .
323323///
324324/// [compare] defaults to [Comparable.compare] .
325- T maxAll <T >(Iterable <T > iter, [int compare (T value, T value2)]) {
326- compare ?? = (value1, value2) => (value1 as Comparable ).compareTo (value2);
325+ T maxAll <T extends Comparable >(Iterable <T > iter,
326+ [int compare (T element1, T element2)]) {
327+ if (compare == null ) compare = Comparable .compare;
327328 return iter
328329 .reduce ((max, element) => compare (element, max) > 0 ? element : max);
329330}
330331
331332/// Replace each instance of [matcher] in [source] with the return value of
332333/// [fn] .
333- String replace (String source, Pattern matcher, String fn (Match )) {
334+ String replace (String source, Pattern matcher, String fn (Match match )) {
334335 var buffer = new StringBuffer ();
335336 var start = 0 ;
336337 for (var match in matcher.allMatches (source)) {
@@ -399,7 +400,7 @@ Future<Stream<T>> validateStream<T>(Stream<T> stream) {
399400 // We got a value, so the stream is valid.
400401 if (! completer.isCompleted) completer.complete (controller.stream);
401402 controller.add (value);
402- }, onError: (error, [stackTrace]) {
403+ }, onError: (error, [StackTrace stackTrace]) {
403404 // If the error came after values, it's OK.
404405 if (completer.isCompleted) {
405406 controller.addError (error, stackTrace);
@@ -425,13 +426,13 @@ Future<Stream<T>> validateStream<T>(Stream<T> stream) {
425426/// Returns a [Future] that will complete to the first element of [stream] .
426427///
427428/// Unlike [Stream.first] , this is safe to use with single-subscription streams.
428- Future streamFirst (Stream stream) {
429+ Future < T > streamFirst < T > (Stream < T > stream) {
429430 var completer = new Completer ();
430431 var subscription;
431432 subscription = stream.listen ((value) {
432433 subscription.cancel ();
433434 completer.complete (value);
434- }, onError: (e, [stackTrace]) {
435+ }, onError: (e, [StackTrace stackTrace]) {
435436 completer.completeError (e, stackTrace);
436437 }, onDone: () {
437438 completer.completeError (new StateError ("No elements" ), new Chain .current ());
0 commit comments