Chromium Code Reviews

Side by Side Diff: samples/swarm/swarm_ui_lib/observable/observable.dart

Issue 13548002: Add Iterable.fold (and Stream.fold) which replace `reduce`. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 library observable; 5 library observable;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 part 'ChangeEvent.dart'; 9 part 'ChangeEvent.dart';
10 part 'EventBatch.dart'; 10 part 'EventBatch.dart';
(...skipping 267 matching lines...)
278 278
279 bool contains(T element) { 279 bool contains(T element) {
280 throw new UnimplementedError(); 280 throw new UnimplementedError();
281 } 281 }
282 282
283 dynamic reduce(var initialValue, 283 dynamic reduce(var initialValue,
284 dynamic combine(var previousValue, T element)) { 284 dynamic combine(var previousValue, T element)) {
285 throw new UnimplementedError(); 285 throw new UnimplementedError();
286 } 286 }
287 287
288 dynamic fold(var initialValue,
289 dynamic combine(var previousValue, T element)) {
290 throw new UnimplementedError();
291 }
288 292
289 // Iterable<T>: 293 // Iterable<T>:
290 Iterator<T> get iterator => _internal.iterator; 294 Iterator<T> get iterator => _internal.iterator;
291 295
292 // Collection<T>: 296 // Collection<T>:
293 Iterable<T> where(bool f(T element)) => _internal.where(f); 297 Iterable<T> where(bool f(T element)) => _internal.where(f);
294 Iterable map(f(T element)) => _internal.map(f); 298 Iterable map(f(T element)) => _internal.map(f);
295 Iterable expand(Iterable f(T element)) => _internal.expand(f); 299 Iterable expand(Iterable f(T element)) => _internal.expand(f);
296 List<T> skip(int count) => _internal.skip(count); 300 List<T> skip(int count) => _internal.skip(count);
297 List<T> take(int count) => _internal.take(count); 301 List<T> take(int count) => _internal.take(count);
(...skipping 37 matching lines...)
335 // Only fire on an actual change. 339 // Only fire on an actual change.
336 if (!identical(newValue, _value)) { 340 if (!identical(newValue, _value)) {
337 final oldValue = _value; 341 final oldValue = _value;
338 _value = newValue; 342 _value = newValue;
339 recordPropertyUpdate("value", newValue, oldValue); 343 recordPropertyUpdate("value", newValue, oldValue);
340 } 344 }
341 } 345 }
342 346
343 T _value; 347 T _value;
344 } 348 }
OLDNEW

Powered by Google App Engine