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

Side by Side Diff: sdk/lib/core/list.dart

Issue 13863012: Refactor List.setRange function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 8 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/collection/queue.dart ('k') | sdk/lib/html/dart2js/html_dart2js.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 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * A [List] is an indexable collection with a length. 8 * A [List] is an indexable collection with a length.
9 * 9 *
10 * A `List` implementation can choose not to support all methods 10 * A `List` implementation can choose not to support all methods
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 * 256 *
257 * var list = [1, 2, 3, 4, 5]; 257 * var list = [1, 2, 3, 4, 5];
258 * var range = list.getRange(1, 4); 258 * var range = list.getRange(1, 4);
259 * print(range.join(', ')); // => 2, 3, 4 259 * print(range.join(', ')); // => 2, 3, 4
260 * list.length = 3; 260 * list.length = 3;
261 * print(range.join(', ')); // => 2, 3 261 * print(range.join(', ')); // => 2, 3
262 */ 262 */
263 Iterable<E> getRange(int start, int end); 263 Iterable<E> getRange(int start, int end);
264 264
265 /** 265 /**
266 * Copies [length] elements of [from], starting 266 * Copies the elements of [iterable], skipping the [skipCount] first elements
267 * at [startFrom], into the list, starting at [start]. 267 * into the range [start] - [end] of `this`.
268 * If [length] is 0, this method does not do anything. 268 *
269 * Throws an [ArgumentError] if [length] is negative. 269 * If [start] equals [end] and represent a legal range, this method has
270 * Throws an [RangeError] if [start] or 270 * no effect.
271 * [:start + length - 1:] are out of range for [:this:], or if 271 *
272 * [startFrom] or [:startFrom + length - 1:] are out of range for [from]. 272 * It is an error if [start]..[end] is not a valid range pointing into the
273 * `this`.
274 *
275 * It is an error if the [iterable] does not have enough elements after
276 * skipping [skipCount] elements.
273 */ 277 */
274 void setRange(int start, int length, List<E> from, [int startFrom]); 278 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]);
275 279
276 /** 280 /**
277 * Removes [length] elements from the list, beginning at [start]. 281 * Removes [length] elements from the list, beginning at [start].
278 * Throws an [UnsupportedError] if the list is 282 * Throws an [UnsupportedError] if the list is
279 * not extendable. 283 * not extendable.
280 * If [length] is 0, this method does not do anything. 284 * If [length] is 0, this method does not do anything.
281 * Throws an [ArgumentError] if [length] is negative. 285 * Throws an [ArgumentError] if [length] is negative.
282 * Throws an [RangeError] if [start] or 286 * Throws an [RangeError] if [start] or
283 * [:start + length: - 1] are out of range. 287 * [:start + length: - 1] are out of range.
284 */ 288 */
(...skipping 14 matching lines...) Expand all
299 void insertRange(int start, int length, [E fill]); 303 void insertRange(int start, int length, [E fill]);
300 304
301 /** 305 /**
302 * Returns an unmodifiable [Map] view of `this`. 306 * Returns an unmodifiable [Map] view of `this`.
303 * 307 *
304 * It has the indices of this list as keys, and the corresponding elements 308 * It has the indices of this list as keys, and the corresponding elements
305 * as values. 309 * as values.
306 */ 310 */
307 Map<int, E> asMap(); 311 Map<int, E> asMap();
308 } 312 }
OLDNEW
« no previous file with comments | « sdk/lib/collection/queue.dart ('k') | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698