| 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 _GrowableList<T> implements List<T> { | 5 class _GrowableList<T> implements List<T> { |
| 6 | 6 |
| 7 void insert(int index, T element) { | 7 void insert(int index, T element) { |
| 8 if ((index < 0) || (index > length)) { | 8 if ((index < 0) || (index > length)) { |
| 9 throw new RangeError.range(index, 0, length); | 9 throw new RangeError.range(index, 0, length); |
| 10 } | 10 } |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 if (length != initialLength) throw new ConcurrentModificationError(this); | 255 if (length != initialLength) throw new ConcurrentModificationError(this); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 String join([String separator = ""]) { | 259 String join([String separator = ""]) { |
| 260 if (isEmpty) return ""; | 260 if (isEmpty) return ""; |
| 261 if (this.length == 1) return "${this[0]}"; | 261 if (this.length == 1) return "${this[0]}"; |
| 262 StringBuffer buffer = new StringBuffer(); | 262 StringBuffer buffer = new StringBuffer(); |
| 263 if (separator.isEmpty) { | 263 if (separator.isEmpty) { |
| 264 for (int i = 0; i < this.length; i++) { | 264 for (int i = 0; i < this.length; i++) { |
| 265 buffer.write("${this[i]}"); | 265 buffer.write(this[i]); |
| 266 } | 266 } |
| 267 } else { | 267 } else { |
| 268 buffer.write("${this[0]}"); | 268 buffer.write(this[0]); |
| 269 for (int i = 1; i < this.length; i++) { | 269 for (int i = 1; i < this.length; i++) { |
| 270 buffer.write(separator); | 270 buffer.write(separator); |
| 271 buffer.write("${this[i]}"); | 271 buffer.write(this[i]); |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 return buffer.toString(); | 274 return buffer.toString(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 Iterable map(f(T element)) { | 277 Iterable map(f(T element)) { |
| 278 return IterableMixinWorkaround.mapList(this, f); | 278 return IterableMixinWorkaround.mapList(this, f); |
| 279 } | 279 } |
| 280 | 280 |
| 281 T reduce(T combine(T value, T element)) { | 281 T reduce(T combine(T value, T element)) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 } | 377 } |
| 378 | 378 |
| 379 Set<T> toSet() { | 379 Set<T> toSet() { |
| 380 return new Set<T>.from(this); | 380 return new Set<T>.from(this); |
| 381 } | 381 } |
| 382 | 382 |
| 383 Map<int, T> asMap() { | 383 Map<int, T> asMap() { |
| 384 return new IterableMixinWorkaround<T>().asMapList(this); | 384 return new IterableMixinWorkaround<T>().asMapList(this); |
| 385 } | 385 } |
| 386 } | 386 } |
| OLD | NEW |