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 static final int _classId = (new _GrowableObjectArray(0))._cid; | 6 static final int _classId = (new _GrowableObjectArray(0))._cid; |
7 | 7 |
8 void insert(int index, T element) { | 8 void insert(int index, T element) { |
9 if (index < 0 || index > length) { | 9 if (index < 0 || index > length) { |
10 throw new RangeError.range(index, 0, length); | 10 throw new RangeError.range(index, 0, length); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 | 318 |
319 T elementAt(int index) { | 319 T elementAt(int index) { |
320 return this[index]; | 320 return this[index]; |
321 } | 321 } |
322 | 322 |
323 bool get isEmpty { | 323 bool get isEmpty { |
324 return this.length == 0; | 324 return this.length == 0; |
325 } | 325 } |
326 | 326 |
| 327 bool get isNotEmpty => !isEmpty; |
| 328 |
327 void clear() { | 329 void clear() { |
328 this.length = 0; | 330 this.length = 0; |
329 } | 331 } |
330 | 332 |
331 Iterable<T> get reversed => IterableMixinWorkaround.reversedList(this); | 333 Iterable<T> get reversed => IterableMixinWorkaround.reversedList(this); |
332 | 334 |
333 void sort([int compare(T a, T b)]) { | 335 void sort([int compare(T a, T b)]) { |
334 IterableMixinWorkaround.sortList(this, compare); | 336 IterableMixinWorkaround.sortList(this, compare); |
335 } | 337 } |
336 | 338 |
(...skipping 10 matching lines...) Expand all Loading... |
347 } | 349 } |
348 | 350 |
349 Set<T> toSet() { | 351 Set<T> toSet() { |
350 return new Set<T>.from(this); | 352 return new Set<T>.from(this); |
351 } | 353 } |
352 | 354 |
353 Map<int, T> asMap() { | 355 Map<int, T> asMap() { |
354 return IterableMixinWorkaround.asMapList(this); | 356 return IterableMixinWorkaround.asMapList(this); |
355 } | 357 } |
356 } | 358 } |
OLD | NEW |