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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 void retainWhere(bool test(T element)) { | 59 void retainWhere(bool test(T element)) { |
60 IterableMixinWorkaround.removeWhereList(this, | 60 IterableMixinWorkaround.removeWhereList(this, |
61 (T element) => !test(element)); | 61 (T element) => !test(element)); |
62 } | 62 } |
63 | 63 |
64 Iterable<T> getRange(int start, int end) { | 64 Iterable<T> getRange(int start, int end) { |
65 return IterableMixinWorkaround.getRangeList(this, start, end); | 65 return IterableMixinWorkaround.getRangeList(this, start, end); |
66 } | 66 } |
67 | 67 |
68 void setRange(int start, int length, List<T> from, [int startFrom = 0]) { | 68 void setRange(int start, int end, Iterable<T> iterable, [int skipCount = 0]) { |
69 IterableMixinWorkaround.setRangeList(this, start, length, from, startFrom); | 69 IterableMixinWorkaround.setRangeList(this, start, end, iterable, skipCount); |
70 } | 70 } |
71 | 71 |
72 void removeRange(int start, int length) { | 72 void removeRange(int start, int length) { |
73 if (length == 0) { | 73 if (length == 0) { |
74 return; | 74 return; |
75 } | 75 } |
76 Arrays.rangeCheck(this, start, length); | 76 Arrays.rangeCheck(this, start, length); |
77 Arrays.copy(this, | 77 Arrays.copy(this, |
78 start + length, | 78 start + length, |
79 this, | 79 this, |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } | 337 } |
338 | 338 |
339 Set<T> toSet() { | 339 Set<T> toSet() { |
340 return new Set<T>.from(this); | 340 return new Set<T>.from(this); |
341 } | 341 } |
342 | 342 |
343 Map<int, T> asMap() { | 343 Map<int, T> asMap() { |
344 return IterableMixinWorkaround.asMapList(this); | 344 return IterableMixinWorkaround.asMapList(this); |
345 } | 345 } |
346 } | 346 } |
OLD | NEW |