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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Iterable map(f(T element)) { | 245 Iterable map(f(T element)) { |
246 return IterableMixinWorkaround.mapList(this, f); | 246 return IterableMixinWorkaround.mapList(this, f); |
247 } | 247 } |
248 | 248 |
249 List mappedBy(f(T element)) { | |
250 return IterableMixinWorkaround.mappedByList(this, f); | |
251 } | |
252 | |
253 reduce(initialValue, combine(previousValue, T element)) { | 249 reduce(initialValue, combine(previousValue, T element)) { |
254 return IterableMixinWorkaround.reduce(this, initialValue, combine); | 250 return IterableMixinWorkaround.reduce(this, initialValue, combine); |
255 } | 251 } |
256 | 252 |
257 Iterable<T> where(bool f(T element)) { | 253 Iterable<T> where(bool f(T element)) { |
258 return IterableMixinWorkaround.where(this, f); | 254 return IterableMixinWorkaround.where(this, f); |
259 } | 255 } |
260 | 256 |
261 Iterable expand(Iterable f(T element)) { | 257 Iterable expand(Iterable f(T element)) { |
262 return IterableMixinWorkaround.expand(this, f); | 258 return IterableMixinWorkaround.expand(this, f); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 } | 299 } |
304 | 300 |
305 bool get isEmpty { | 301 bool get isEmpty { |
306 return this.length == 0; | 302 return this.length == 0; |
307 } | 303 } |
308 | 304 |
309 void clear() { | 305 void clear() { |
310 this.length = 0; | 306 this.length = 0; |
311 } | 307 } |
312 | 308 |
313 List<T> get reversed => new ReversedListView<T>(this, 0, null); | 309 Iterable<T> get reversed => new ReversedListIterable<T>(this); |
314 | 310 |
315 void sort([int compare(T a, T b)]) { | 311 void sort([int compare(T a, T b)]) { |
316 IterableMixinWorkaround.sortList(this, compare); | 312 IterableMixinWorkaround.sortList(this, compare); |
317 } | 313 } |
318 | 314 |
319 String toString() { | 315 String toString() { |
320 return Collections.collectionToString(this); | 316 return Collections.collectionToString(this); |
321 } | 317 } |
322 | 318 |
323 Iterator<T> get iterator { | 319 Iterator<T> get iterator { |
324 return new ListIterator<T>(this); | 320 return new ListIterator<T>(this); |
325 } | 321 } |
326 | 322 |
327 List<T> toList() { | 323 List<T> toList() { |
328 return new List<T>.from(this); | 324 return new List<T>.from(this); |
329 } | 325 } |
330 | 326 |
331 Set<T> toSet() { | 327 Set<T> toSet() { |
332 return new Set<T>.from(this); | 328 return new Set<T>.from(this); |
333 } | 329 } |
334 } | 330 } |
OLD | NEW |