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

Side by Side Diff: sdk/lib/html/html_common/lists.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « sdk/lib/html/html_common/filtered_element_list.dart ('k') | sdk/lib/io/directory_impl.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) 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 part of html_common; 5 part of html_common;
6 6
7 class Lists { 7 class Lists {
8 8
9 /** 9 /**
10 * Returns the index in the array [a] of the given [element], starting 10 * Returns the index in the array [a] of the given [element], starting
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 static List getRange(List a, int start, int length, List accumulator) { 59 static List getRange(List a, int start, int length, List accumulator) {
60 if (length < 0) throw new ArgumentError('length'); 60 if (length < 0) throw new ArgumentError('length');
61 if (start < 0) throw new RangeError.value(start); 61 if (start < 0) throw new RangeError.value(start);
62 int end = start + length; 62 int end = start + length;
63 if (end > a.length) throw new RangeError.value(end); 63 if (end > a.length) throw new RangeError.value(end);
64 for (int i = start; i < end; i++) { 64 for (int i = start; i < end; i++) {
65 accumulator.add(a[i]); 65 accumulator.add(a[i]);
66 } 66 }
67 return accumulator; 67 return accumulator;
68 } 68 }
69
70 static String join(List<Object> list, [String separator]) {
71 if (list.isEmpty) return "";
72 if (list.length == 1) return "${list[0]}";
73 StringBuffer buffer = new StringBuffer();
74 if (separator == null || separator == "") {
75 for (int i = 0; i < list.length; i++) {
76 buffer.add("${list[i]}");
77 }
78 } else {
79 buffer.add("${list[0]}");
80 for (int i = 1; i < list.length; i++) {
81 buffer.add(separator);
82 buffer.add("${list[i]}");
83 }
84 }
85 return buffer.toString();
86 }
69 } 87 }
OLDNEW
« no previous file with comments | « sdk/lib/html/html_common/filtered_element_list.dart ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698