Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

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

Issue 12262037: Make List.skip, List.take and List.reversed return Iterables, not Lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments, small fixes. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | sdk/lib/_collection_dev/iterable.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 void set length(int value) { 155 void set length(int value) {
156 _internal.length = value; 156 _internal.length = value;
157 recordGlobalChange(); 157 recordGlobalChange();
158 } 158 }
159 159
160 void clear() { 160 void clear() {
161 _internal.clear(); 161 _internal.clear();
162 recordGlobalChange(); 162 recordGlobalChange();
163 } 163 }
164 164
165 List<T> get reversed => _internal.reversed; 165 Iterable<T> get reversed => _internal.reversed;
166 166
167 void sort([int compare(var a, var b)]) { 167 void sort([int compare(var a, var b)]) {
168 if (compare == null) compare = Comparable.compare; 168 if (compare == null) compare = Comparable.compare;
169 _internal.sort(compare); 169 _internal.sort(compare);
170 recordGlobalChange(); 170 recordGlobalChange();
171 } 171 }
172 172
173 void add(T element) { 173 void add(T element) {
174 recordListInsert(length, element); 174 recordListInsert(length, element);
175 _internal.add(element); 175 _internal.add(element);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 // Only fire on an actual change. 325 // Only fire on an actual change.
326 if (!identical(newValue, _value)) { 326 if (!identical(newValue, _value)) {
327 final oldValue = _value; 327 final oldValue = _value;
328 _value = newValue; 328 _value = newValue;
329 recordPropertyUpdate("value", newValue, oldValue); 329 recordPropertyUpdate("value", newValue, oldValue);
330 } 330 }
331 } 331 }
332 332
333 T _value; 333 T _value;
334 } 334 }
OLDNEW
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | sdk/lib/_collection_dev/iterable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698