Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 class _GrowableObjectArray<T> implements List<T> { | 5 class _GrowableObjectArray<T> implements List<T> { |
| 6 factory _GrowableObjectArray._uninstantiable() { | 6 factory _GrowableObjectArray._uninstantiable() { |
| 7 throw new UnsupportedError( | 7 throw new UnsupportedError( |
| 8 "GrowableObjectArray can only be allocated by the VM"); | 8 "GrowableObjectArray can only be allocated by the VM"); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 } else { | 235 } else { |
| 236 buffer.add("${this[0]}"); | 236 buffer.add("${this[0]}"); |
| 237 for (int i = 1; i < this.length; i++) { | 237 for (int i = 1; i < this.length; i++) { |
| 238 buffer.add(separator); | 238 buffer.add(separator); |
| 239 buffer.add("${this[i]}"); | 239 buffer.add("${this[i]}"); |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 return buffer.toString(); | 242 return buffer.toString(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 List mappedBy(f(T element)) { | 245 Iterable map(f(T element)) { |
| 246 return IterableMixinWorkaround.mappedByList(this, f); | 246 return IterableMixinWorkaround.mappedByList(this, f); |
|
floitsch
2013/01/30 14:48:44
should return an Iterable.
Lasse Reichstein Nielsen
2013/01/31 11:33:49
Done.
| |
| 247 } | 247 } |
| 248 | 248 |
| 249 Iterable mappedBy(f(T element)) => map(f); | |
| 250 | |
| 249 reduce(initialValue, combine(previousValue, T element)) { | 251 reduce(initialValue, combine(previousValue, T element)) { |
| 250 return IterableMixinWorkaround.reduce(this, initialValue, combine); | 252 return IterableMixinWorkaround.reduce(this, initialValue, combine); |
| 251 } | 253 } |
| 252 | 254 |
| 253 Iterable<T> where(bool f(T element)) { | 255 Iterable<T> where(bool f(T element)) { |
| 254 return IterableMixinWorkaround.where(this, f); | 256 return IterableMixinWorkaround.where(this, f); |
| 255 } | 257 } |
| 256 | 258 |
| 257 List<T> take(int n) { | 259 Iterable<T> take(int n) { |
| 258 return IterableMixinWorkaround.takeList(this, n); | 260 return IterableMixinWorkaround.takeList(this, n); |
| 259 } | 261 } |
| 260 | 262 |
| 261 Iterable<T> takeWhile(bool test(T value)) { | 263 Iterable<T> takeWhile(bool test(T value)) { |
| 262 return IterableMixinWorkaround.takeWhile(this, test); | 264 return IterableMixinWorkaround.takeWhile(this, test); |
| 263 } | 265 } |
| 264 | 266 |
| 265 List<T> skip(int n) { | 267 Iterable<T> skip(int n) { |
| 266 return IterableMixinWorkaround.skipList(this, n); | 268 return IterableMixinWorkaround.skipList(this, n); |
| 267 } | 269 } |
| 268 | 270 |
| 269 Iterable<T> skipWhile(bool test(T value)) { | 271 Iterable<T> skipWhile(bool test(T value)) { |
| 270 return IterableMixinWorkaround.skipWhile(this, test); | 272 return IterableMixinWorkaround.skipWhile(this, test); |
| 271 } | 273 } |
| 272 | 274 |
| 273 bool every(bool f(T element)) { | 275 bool every(bool f(T element)) { |
| 274 return IterableMixinWorkaround.every(this, f); | 276 return IterableMixinWorkaround.every(this, f); |
| 275 } | 277 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 317 } | 319 } |
| 318 | 320 |
| 319 List<T> toList() { | 321 List<T> toList() { |
| 320 return new List<T>.from(this); | 322 return new List<T>.from(this); |
| 321 } | 323 } |
| 322 | 324 |
| 323 Set<T> toSet() { | 325 Set<T> toSet() { |
| 324 return new Set<T>.from(this); | 326 return new Set<T>.from(this); |
| 325 } | 327 } |
| 326 } | 328 } |
| OLD | NEW |