Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Side by Side Diff: runtime/lib/array.dart

Issue 11931034: Add methods to Collection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/serialization/lib/src/serialization_rule.dart ('k') | runtime/lib/byte_array.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5
6 // TODO(srdjan): Use shared array implementation. 6 // TODO(srdjan): Use shared array implementation.
7 class _ObjectArray<E> implements List<E> { 7 class _ObjectArray<E> implements List<E> {
8 8
9 factory _ObjectArray(int length) native "ObjectArray_allocate"; 9 factory _ObjectArray(int length) native "ObjectArray_allocate";
10 10
(...skipping 11 matching lines...) Expand all
22 int srcStart, 22 int srcStart,
23 int dstStart, 23 int dstStart,
24 int count) 24 int count)
25 native "ObjectArray_copyFromObjectArray"; 25 native "ObjectArray_copyFromObjectArray";
26 26
27 E removeAt(int index) { 27 E removeAt(int index) {
28 throw new UnsupportedError( 28 throw new UnsupportedError(
29 "Cannot remove element of a non-extendable array"); 29 "Cannot remove element of a non-extendable array");
30 } 30 }
31 31
32 void remove(Object element) {
33 throw new UnsupportedError(
34 "Cannot remove element of a non-extendable array");
35 }
36
37 void removeAll(Iterable elements) {
38 throw new UnsupportedError(
39 "Cannot remove element of a non-extendable array");
40 }
41
42 void retainAll(Iterable elements) {
43 throw new UnsupportedError(
44 "Cannot remove element of a non-extendable array");
45 }
46
47 void removeMatching(bool test(E element)) {
48 throw new UnsupportedError(
49 "Cannot remove element of a non-extendable array");
50 }
51
52 void retainMatching(bool test(E element)) {
53 throw new UnsupportedError(
54 "Cannot remove element of a non-extendable array");
55 }
56
32 void setRange(int start, int length, List<E> from, [int startFrom = 0]) { 57 void setRange(int start, int length, List<E> from, [int startFrom = 0]) {
33 if (length < 0) { 58 if (length < 0) {
34 throw new ArgumentError("negative length $length"); 59 throw new ArgumentError("negative length $length");
35 } 60 }
36 if (from is _ObjectArray) { 61 if (from is _ObjectArray) {
37 _copyFromObjectArray(from, startFrom, start, length); 62 _copyFromObjectArray(from, startFrom, start, length);
38 } else { 63 } else {
39 Arrays.copy(from, startFrom, this, start, length); 64 Arrays.copy(from, startFrom, this, start, length);
40 } 65 }
41 } 66 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 "Cannot modify an immutable array"); 252 "Cannot modify an immutable array");
228 } 253 }
229 254
230 int get length native "ObjectArray_getLength"; 255 int get length native "ObjectArray_getLength";
231 256
232 E removeAt(int index) { 257 E removeAt(int index) {
233 throw new UnsupportedError( 258 throw new UnsupportedError(
234 "Cannot modify an immutable array"); 259 "Cannot modify an immutable array");
235 } 260 }
236 261
262 void remove(Object element) {
263 throw new UnsupportedError(
264 "Cannot modify an immutable array");
265 }
266
267 void removeAll(Iterable elements) {
268 throw new UnsupportedError(
269 "Cannot modify an immutable array");
270 }
271
272 void retainAll(Iterable elements) {
273 throw new UnsupportedError(
274 "Cannot modify an immutable array");
275 }
276
277 void removeMatching(bool test(E element)) {
278 throw new UnsupportedError(
279 "Cannot modify an immutable array");
280 }
281
282 void retainMatching(bool test(E element)) {
283 throw new UnsupportedError(
284 "Cannot modify an immutable array");
285 }
286
237 void copyFrom(List src, int srcStart, int dstStart, int count) { 287 void copyFrom(List src, int srcStart, int dstStart, int count) {
238 throw new UnsupportedError( 288 throw new UnsupportedError(
239 "Cannot modify an immutable array"); 289 "Cannot modify an immutable array");
240 } 290 }
241 291
242 void setRange(int start, int length, List<E> from, [int startFrom = 0]) { 292 void setRange(int start, int length, List<E> from, [int startFrom = 0]) {
243 throw new UnsupportedError( 293 throw new UnsupportedError(
244 "Cannot modify an immutable array"); 294 "Cannot modify an immutable array");
245 } 295 }
246 296
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 485 }
436 _position = _length; 486 _position = _length;
437 _current = null; 487 _current = null;
438 return false; 488 return false;
439 } 489 }
440 490
441 E get current { 491 E get current {
442 return _current; 492 return _current;
443 } 493 }
444 } 494 }
OLDNEW
« no previous file with comments | « pkg/serialization/lib/src/serialization_rule.dart ('k') | runtime/lib/byte_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698