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

Unified Diff: runtime/lib/list_implementation.dart

Issue 8339015: Rename GrowableObjectArray to ListImplementation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/lib_impl_sources.gypi ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/list_implementation.dart
===================================================================
--- runtime/lib/list_implementation.dart (revision 505)
+++ runtime/lib/list_implementation.dart (working copy)
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-class GrowableObjectArray<T> implements Array<T> {
+class ListImplementation<T> implements Array<T> {
ObjectArray<T> backingArray;
void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
@@ -76,10 +76,10 @@
// is not in the array.
static final int ABSENT = -1;
- GrowableObjectArray()
+ ListImplementation()
: _length = 0, backingArray = new ObjectArray<T>(4) {}
- GrowableObjectArray.withCapacity(int capacity) {
+ ListImplementation.withCapacity(int capacity) {
_length = 0;
if (capacity <= 0) {
capacity = 4;
@@ -87,7 +87,7 @@
backingArray = new ObjectArray<T>(capacity);
}
- GrowableObjectArray._usingArray(Array<T> array) {
+ ListImplementation._usingArray(Array<T> array) {
backingArray = array;
_length = array.length;
if (_length == 0) {
@@ -95,8 +95,8 @@
}
}
- factory GrowableObjectArray.from(Collection<T> other) {
- Array result = new GrowableObjectArray();
+ factory ListImplementation.from(Collection<T> other) {
+ List result = new List();
result.addAll(other);
return result;
}
@@ -190,7 +190,7 @@
}
Collection<T> filter(bool f(T element)) {
- return Collections.filter(this, new GrowableObjectArray<T>(), f);
+ return Collections.filter(this, new List<T>(), f);
}
bool every(bool f(T element)) {
@@ -214,29 +214,27 @@
}
Iterator<T> iterator() {
- return new VariableSizeArrayIterator<T>(this);
+ return new ListIterator<T>(this);
}
}
-// Iterator for arrays with variable size.
-class VariableSizeArrayIterator<T> implements Iterator<T> {
- VariableSizeArrayIterator(GrowableObjectArray<T> array)
- : _array = array, _pos = 0 {
- }
+// Iterator for lists with variable size.
+class ListIterator<T> implements Iterator<T> {
+ ListIterator(List<T> this._list) : _pos = 0;
bool hasNext() {
- return _array._length > _pos;
+ return _list._length > _pos;
}
T next() {
if (!hasNext()) {
throw const NoMoreElementsException();
}
- return _array[_pos++];
+ return _list[_pos++];
}
- final GrowableObjectArray<T> _array;
+ final List<T> _list;
int _pos;
}
« no previous file with comments | « runtime/lib/lib_impl_sources.gypi ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698