OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.async; | 5 part of dart.async; |
6 | 6 |
7 // ------------------------------------------------------------------- | 7 // ------------------------------------------------------------------- |
8 // Core Stream types | 8 // Core Stream types |
9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
10 | 10 |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 475 } |
476 | 476 |
477 /** | 477 /** |
478 * Chains this stream as the input of the provided [StreamTransformer]. | 478 * Chains this stream as the input of the provided [StreamTransformer]. |
479 * | 479 * |
480 * Returns the result of [:streamTransformer.bind:] itself. | 480 * Returns the result of [:streamTransformer.bind:] itself. |
481 * | 481 * |
482 * The `streamTransformer` can decide whether it wants to return a | 482 * The `streamTransformer` can decide whether it wants to return a |
483 * broadcast stream or not. | 483 * broadcast stream or not. |
484 */ | 484 */ |
485 Stream transform(StreamTransformer<T, dynamic> streamTransformer) { | 485 Stream/*<S>*/ transform/*<S>*/( |
| 486 StreamTransformer<T, dynamic/*=S*/ > streamTransformer) { |
486 return streamTransformer.bind(this); | 487 return streamTransformer.bind(this); |
487 } | 488 } |
488 | 489 |
489 /** | 490 /** |
490 * Reduces a sequence of values by repeatedly applying [combine]. | 491 * Reduces a sequence of values by repeatedly applying [combine]. |
491 */ | 492 */ |
492 Future<T> reduce(T combine(T previous, T element)) { | 493 Future<T> reduce(T combine(T previous, T element)) { |
493 _Future<T> result = new _Future<T>(); | 494 _Future<T> result = new _Future<T>(); |
494 bool seenFirst = false; | 495 bool seenFirst = false; |
495 T value; | 496 T value; |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 class _ControllerEventSinkWrapper<T> implements EventSink<T> { | 1662 class _ControllerEventSinkWrapper<T> implements EventSink<T> { |
1662 EventSink _sink; | 1663 EventSink _sink; |
1663 _ControllerEventSinkWrapper(this._sink); | 1664 _ControllerEventSinkWrapper(this._sink); |
1664 | 1665 |
1665 void add(T data) { _sink.add(data); } | 1666 void add(T data) { _sink.add(data); } |
1666 void addError(error, [StackTrace stackTrace]) { | 1667 void addError(error, [StackTrace stackTrace]) { |
1667 _sink.addError(error, stackTrace); | 1668 _sink.addError(error, stackTrace); |
1668 } | 1669 } |
1669 void close() { _sink.close(); } | 1670 void close() { _sink.close(); } |
1670 } | 1671 } |
OLD | NEW |