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

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

Issue 13528004: Remove addLast from List. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove typo 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 | « runtime/lib/array.dart ('k') | runtime/lib/typeddata.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 class _GrowableObjectArray<T> implements List<T> { 5 class _GrowableObjectArray<T> implements List<T> {
6 factory _GrowableObjectArray._uninstantiable() { 6 factory _GrowableObjectArray._uninstantiable() {
7 throw new UnsupportedError( 7 throw new UnsupportedError(
8 "GrowableObjectArray can only be allocated by the VM"); 8 "GrowableObjectArray can only be allocated by the VM");
9 } 9 }
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // doubling its size. 171 // doubling its size.
172 void add(T value) { 172 void add(T value) {
173 var len = length; 173 var len = length;
174 if (len == _capacity) { 174 if (len == _capacity) {
175 _grow(len * 2); 175 _grow(len * 2);
176 } 176 }
177 _setLength(len + 1); 177 _setLength(len + 1);
178 this[len] = value; 178 this[len] = value;
179 } 179 }
180 180
181 void addLast(T element) {
182 add(element);
183 }
184
185 void addAll(Iterable<T> iterable) { 181 void addAll(Iterable<T> iterable) {
186 for (T elem in iterable) { 182 for (T elem in iterable) {
187 add(elem); 183 add(elem);
188 } 184 }
189 } 185 }
190 186
191 T removeLast() { 187 T removeLast() {
192 var len = length - 1; 188 var len = length - 1;
193 var elem = this[len]; 189 var elem = this[len];
194 this[len] = null; 190 this[len] = null;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } 343 }
348 344
349 Set<T> toSet() { 345 Set<T> toSet() {
350 return new Set<T>.from(this); 346 return new Set<T>.from(this);
351 } 347 }
352 348
353 Map<int, T> asMap() { 349 Map<int, T> asMap() {
354 return IterableMixinWorkaround.asMapList(this); 350 return IterableMixinWorkaround.asMapList(this);
355 } 351 }
356 } 352 }
OLDNEW
« no previous file with comments | « runtime/lib/array.dart ('k') | runtime/lib/typeddata.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698