@@ -292,33 +292,6 @@ List/*<T>*/ ordered/*<T extends Comparable<T>>*/(Iterable/*<T>*/ iter) {
292
292
return list;
293
293
}
294
294
295
- /// Returns the element of [iter] for which [f] returns the minimum value.
296
- minBy (Iterable iter, Comparable f (element)) {
297
- var min = null ;
298
- var minComparable = null ;
299
- for (var element in iter) {
300
- var comparable = f (element);
301
- if (minComparable == null || comparable.compareTo (minComparable) < 0 ) {
302
- min = element;
303
- minComparable = comparable;
304
- }
305
- }
306
- return min;
307
- }
308
-
309
- /// Returns every pair of consecutive elements in [iter] .
310
- ///
311
- /// For example, if [iter] is `[1, 2, 3, 4]` , this will return `[(1, 2), (2, 3),
312
- /// (3, 4)]`.
313
- Iterable <Pair > pairs (Iterable iter) {
314
- var previous = iter.first;
315
- return iter.skip (1 ).map ((element) {
316
- var oldPrevious = previous;
317
- previous = element;
318
- return new Pair (oldPrevious, element);
319
- });
320
- }
321
-
322
295
/// Given a list of filenames, returns a set of patterns that can be used to
323
296
/// filter for those filenames.
324
297
///
@@ -356,15 +329,6 @@ maxAll(Iterable iter, [int compare(element1, element2)]) {
356
329
.reduce ((max, element) => compare (element, max) > 0 ? element : max);
357
330
}
358
331
359
- /// Returns the minimum value in [iter] by [compare] .
360
- ///
361
- /// [compare] defaults to [Comparable.compare] .
362
- minAll (Iterable iter, [int compare (element1, element2)]) {
363
- if (compare == null ) compare = Comparable .compare;
364
- return iter
365
- .reduce ((max, element) => compare (element, max) < 0 ? element : max);
366
- }
367
-
368
332
/// Replace each instance of [matcher] in [source] with the return value of
369
333
/// [fn] .
370
334
String replace (String source, Pattern matcher, String fn (Match )) {
@@ -379,14 +343,6 @@ String replace(String source, Pattern matcher, String fn(Match)) {
379
343
return buffer.toString ();
380
344
}
381
345
382
- /// Returns whether or not [str] ends with [matcher] .
383
- bool endsWithPattern (String str, Pattern matcher) {
384
- for (var match in matcher.allMatches (str)) {
385
- if (match.end == str.length) return true ;
386
- }
387
- return false ;
388
- }
389
-
390
346
/// Returns the hex-encoded sha1 hash of [source] .
391
347
String sha1 (String source) =>
392
348
crypto.sha1.convert (UTF8 .encode (source)).toString ();
@@ -484,17 +440,6 @@ Future streamFirst(Stream stream) {
484
440
return completer.future;
485
441
}
486
442
487
- /// Returns a wrapped version of [stream] along with a [StreamSubscription] that
488
- /// can be used to control the wrapped stream.
489
- Pair <Stream , StreamSubscription > streamWithSubscription (Stream stream) {
490
- var controller = stream.isBroadcast
491
- ? new StreamController .broadcast (sync : true )
492
- : new StreamController (sync : true );
493
- var subscription = stream.listen (controller.add,
494
- onError: controller.addError, onDone: controller.close);
495
- return new Pair <Stream , StreamSubscription >(controller.stream, subscription);
496
- }
497
-
498
443
/// A regular expression matching a trailing CR character.
499
444
final _trailingCR = new RegExp (r"\r$" );
500
445
@@ -530,19 +475,6 @@ Stream<String> streamToLines(Stream<String> stream) {
530
475
}));
531
476
}
532
477
533
- /// Like [Iterable.where] , but allows [test] to return [Future] s and uses the
534
- /// results of those [Future] s as the test.
535
- Future <Iterable > futureWhere (Iterable iter, test (value)) {
536
- return Future
537
- .wait (iter.map ((e) {
538
- var result = test (e);
539
- if (result is ! Future ) result = new Future .value (result);
540
- return result.then ((result) => new Pair (e, result));
541
- }))
542
- .then ((pairs) => pairs.where ((pair) => pair.last))
543
- .then ((pairs) => pairs.map ((pair) => pair.first));
544
- }
545
-
546
478
// TODO(nweiz): unify the following functions with the utility functions in
547
479
// pkg/http.
548
480
@@ -602,19 +534,6 @@ String mapToQuery(Map<String, String> map) {
602
534
Set /*<T>*/ unionAll/*<T>*/ (Iterable <Set /*<T>*/ > sets) =>
603
535
sets.fold (new Set (), (union, set ) => union.union (set ));
604
536
605
- // TODO(nweiz): remove this when issue 9068 has been fixed.
606
- /// Whether [uri1] and [uri2] are equal.
607
- ///
608
- /// This consider HTTP URIs to default to port 80, and HTTPs URIs to default to
609
- /// port 443.
610
- bool urisEqual (Uri uri1, Uri uri2) =>
611
- canonicalizeUri (uri1) == canonicalizeUri (uri2);
612
-
613
- /// Return [uri] with redundant port information removed.
614
- Uri canonicalizeUri (Uri uri) {
615
- return uri;
616
- }
617
-
618
537
/// Returns a human-friendly representation of [inputPath] .
619
538
///
620
539
/// If [inputPath] isn't too distant from the current working directory, this
0 commit comments