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

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

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | « dart/runtime/lib/collection_patch.dart ('k') | dart/runtime/lib/isolate.cc » ('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 class _GrowableList<T> implements List<T> { 5 class _GrowableList<T> implements List<T> {
6 static final int _classId = (new _GrowableList(0))._cid; 6 static final int _classId = (new _GrowableList(0))._cid;
7 7
8 void insert(int index, T element) { 8 void insert(int index, T element) {
9 if (index < 0 || index > length) { 9 if (index < 0 || index > length) {
10 throw new RangeError.range(index, 0, length); 10 throw new RangeError.range(index, 0, length);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 void replaceRange(int start, int end, Iterable<T> iterable) { 107 void replaceRange(int start, int end, Iterable<T> iterable) {
108 IterableMixinWorkaround.replaceRangeList(this, start, end, iterable); 108 IterableMixinWorkaround.replaceRangeList(this, start, end, iterable);
109 } 109 }
110 110
111 void fillRange(int start, int end, [T fillValue]) { 111 void fillRange(int start, int end, [T fillValue]) {
112 IterableMixinWorkaround.fillRangeList(this, start, end, fillValue); 112 IterableMixinWorkaround.fillRangeList(this, start, end, fillValue);
113 } 113 }
114 114
115 List<T> sublist(int start, [int end]) { 115 List<T> sublist(int start, [int end]) {
116 Arrays.indicesCheck(this, start, end); 116 Arrays.indicesCheck(this, start, end);
117 if (end == null) end = length; 117 if (end == null) end = this.length;
118 int length = end - start; 118 int length = end - start;
119 if (start == end) return <T>[]; 119 if (start == end) return <T>[];
120 List list = new _GrowableList<T>.withCapacity(length); 120 List list = new _GrowableList<T>.withCapacity(length);
121 list.length = length; 121 list.length = length;
122 Arrays.copy(this, start, list, 0, length); 122 Arrays.copy(this, start, list, 0, length);
123 return list; 123 return list;
124 } 124 }
125 125
126 factory _GrowableList(int length) { 126 factory _GrowableList(int length) {
127 var data = new _List((length == 0) ? 4 : length); 127 var data = new _List((length == 0) ? 4 : length);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 353 }
354 354
355 Set<T> toSet() { 355 Set<T> toSet() {
356 return new Set<T>.from(this); 356 return new Set<T>.from(this);
357 } 357 }
358 358
359 Map<int, T> asMap() { 359 Map<int, T> asMap() {
360 return IterableMixinWorkaround.asMapList(this); 360 return IterableMixinWorkaround.asMapList(this);
361 } 361 }
362 } 362 }
OLDNEW
« no previous file with comments | « dart/runtime/lib/collection_patch.dart ('k') | dart/runtime/lib/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698