| OLD | NEW |
| 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 const UnsupportedOperationException( | 7 throw const UnsupportedOperationException( |
| 8 "GrowableObjectArray can only be allocated by the VM"); | 8 "GrowableObjectArray can only be allocated by the VM"); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 200 } |
| 201 | 201 |
| 202 bool isEmpty() { | 202 bool isEmpty() { |
| 203 return this.length === 0; | 203 return this.length === 0; |
| 204 } | 204 } |
| 205 | 205 |
| 206 void clear() { | 206 void clear() { |
| 207 this.length = 0; | 207 this.length = 0; |
| 208 } | 208 } |
| 209 | 209 |
| 210 void sort(int compare(T a, T b)) { | 210 void sort([Comparator<T> compare = Comparable.compare]) { |
| 211 DualPivotQuicksort.sort(this, compare); | 211 DualPivotQuicksort.sort(this, compare); |
| 212 } | 212 } |
| 213 | 213 |
| 214 String toString() { | 214 String toString() { |
| 215 return Collections.collectionToString(this); | 215 return Collections.collectionToString(this); |
| 216 } | 216 } |
| 217 | 217 |
| 218 Iterator<T> iterator() { | 218 Iterator<T> iterator() { |
| 219 return new VariableSizeArrayIterator<T>(this); | 219 return new VariableSizeArrayIterator<T>(this); |
| 220 } | 220 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 234 T next() { | 234 T next() { |
| 235 if (!hasNext()) { | 235 if (!hasNext()) { |
| 236 throw const NoMoreElementsException(); | 236 throw const NoMoreElementsException(); |
| 237 } | 237 } |
| 238 return _array[_pos++]; | 238 return _array[_pos++]; |
| 239 } | 239 } |
| 240 | 240 |
| 241 final _GrowableObjectArray<T> _array; | 241 final _GrowableObjectArray<T> _array; |
| 242 int _pos; | 242 int _pos; |
| 243 } | 243 } |
| OLD | NEW |