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

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

Issue 8277007: IllegalArgumentException expects a string. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 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 | « runtime/lib/array.dart ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 Array<T> { 5 class GrowableObjectArray<T> implements Array<T> {
6 Array<T> backingArray; 6 Array<T> backingArray;
7 7
8 void copyFrom(Array<Object> src, int srcStart, int dstStart, int count) { 8 void copyFrom(Array<Object> src, int srcStart, int dstStart, int count) {
9 Arrays.copy(src, srcStart, this, dstStart, count); 9 Arrays.copy(src, srcStart, this, dstStart, count);
10 } 10 }
11 11
12 void setRange(int start, int length, List<T> from, [int startFrom = 0]) { 12 void setRange(int start, int length, List<T> from, [int startFrom = 0]) {
13 if (length < 0) throw new IllegalArgumentException(length); 13 if (length < 0) {
14 throw new IllegalArgumentException("negative length $length");
15 }
14 Arrays.copy(from, startFrom, this, start, length); 16 Arrays.copy(from, startFrom, this, start, length);
15 } 17 }
16 18
17 void removeRange(int start, int length) { 19 void removeRange(int start, int length) {
18 if (length == 0) { 20 if (length == 0) {
19 return; 21 return;
20 } 22 }
21 if (length < 0) { 23 if (length < 0) {
22 throw const IllegalArgumentException(); 24 throw new IllegalArgumentException("negative length $length");
23 } 25 }
24 if (start < 0 || start >= this.length) { 26 if (start < 0 || start >= this.length) {
25 throw new IndexOutOfRangeException(start); 27 throw new IndexOutOfRangeException(start);
26 } 28 }
27 if (start + length > this.length) { 29 if (start + length > this.length) {
28 throw new IndexOutOfRangeException(start + length); 30 throw new IndexOutOfRangeException(start + length);
29 } 31 }
30 Arrays.copy(backingArray, 32 Arrays.copy(backingArray,
31 start + length, 33 start + length,
32 backingArray, 34 backingArray,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 if (!hasNext()) { 209 if (!hasNext()) {
208 throw const NoMoreElementsException(); 210 throw const NoMoreElementsException();
209 } 211 }
210 return _array[_pos++]; 212 return _array[_pos++];
211 } 213 }
212 214
213 final GrowableObjectArray<T> _array; 215 final GrowableObjectArray<T> _array;
214 int _pos; 216 int _pos;
215 } 217 }
216 218
OLDNEW
« no previous file with comments | « runtime/lib/array.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698