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

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

Issue 9431015: Wrote functions to convert collections and maps to strings and invoked (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 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') | 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) 2011, 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 // TODO(ngeoffray): Rename to Lists. 5 // TODO(ngeoffray): Rename to Lists.
6 class Arrays { 6 class Arrays {
7
8 static String asString(List list) {
9 String result = "[";
10 int len = list.length;
11 for (int i = 0; i < len; i++) {
12 // TODO(4466785): Deal with recursion and formatting.
13 result += list[i].toString() + ", ";
14 }
15 result += "]";
16 return result;
17 }
18
19 static void copy(List src, int srcStart, 7 static void copy(List src, int srcStart,
20 List dst, int dstStart, int count) { 8 List dst, int dstStart, int count) {
21 if (srcStart === null) srcStart = 0; 9 if (srcStart === null) srcStart = 0;
22 if (dstStart === null) dstStart = 0; 10 if (dstStart === null) dstStart = 0;
23 11
24 if (srcStart < dstStart) { 12 if (srcStart < dstStart) {
25 for (int i = srcStart + count - 1, j = dstStart + count - 1; 13 for (int i = srcStart + count - 1, j = dstStart + count - 1;
26 i >= srcStart; i--, j--) { 14 i >= srcStart; i--, j--) {
27 dst[j] = src[i]; 15 dst[j] = src[i];
28 } 16 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 82 }
95 if (start < 0 || start >= a.length) { 83 if (start < 0 || start >= a.length) {
96 throw new IndexOutOfRangeException(start); 84 throw new IndexOutOfRangeException(start);
97 } 85 }
98 if (start + length > a.length) { 86 if (start + length > a.length) {
99 throw new IndexOutOfRangeException(start + length); 87 throw new IndexOutOfRangeException(start + length);
100 } 88 }
101 } 89 }
102 } 90 }
103 91
OLDNEW
« no previous file with comments | « runtime/lib/array.dart ('k') | runtime/lib/byte_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698