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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 void retainWhere(bool test(T element)) { | 67 void retainWhere(bool test(T element)) { |
68 IterableMixinWorkaround.removeWhereList(this, | 68 IterableMixinWorkaround.removeWhereList(this, |
69 (T element) => !test(element)); | 69 (T element) => !test(element)); |
70 } | 70 } |
71 | 71 |
72 Iterable<T> getRange(int start, int end) { | 72 Iterable<T> getRange(int start, int end) { |
73 return IterableMixinWorkaround.getRangeList(this, start, end); | 73 return IterableMixinWorkaround.getRangeList(this, start, end); |
74 } | 74 } |
75 | 75 |
76 void setRange(int start, int length, List<T> from, [int startFrom = 0]) { | 76 void setRange(int start, int end, List<T> from, [int startFrom = 0]) { |
77 IterableMixinWorkaround.setRangeList(this, start, length, from, startFrom); | 77 IterableMixinWorkaround.setRangeList(this, start, end, from, startFrom); |
78 } | 78 } |
79 | 79 |
80 void removeRange(int start, int length) { | 80 void removeRange(int start, int length) { |
81 if (length == 0) { | 81 if (length == 0) { |
82 return; | 82 return; |
83 } | 83 } |
84 Arrays.rangeCheck(this, start, length); | 84 Arrays.rangeCheck(this, start, length); |
85 Arrays.copy(this, | 85 Arrays.copy(this, |
86 start + length, | 86 start + length, |
87 this, | 87 this, |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 } | 349 } |
350 | 350 |
351 Set<T> toSet() { | 351 Set<T> toSet() { |
352 return new Set<T>.from(this); | 352 return new Set<T>.from(this); |
353 } | 353 } |
354 | 354 |
355 Map<int, T> asMap() { | 355 Map<int, T> asMap() { |
356 return IterableMixinWorkaround.asMapList(this); | 356 return IterableMixinWorkaround.asMapList(this); |
357 } | 357 } |
358 } | 358 } |
OLD | NEW |