| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 Array<T> { | 5 class GrowableObjectArray<T> implements Array<T> { |
| 6 Array<T> backingArray; | 6 Array<T> backingArray; |
| 7 | 7 |
| 8 void copyFrom(Array<Object> src, int srcStart, int dstStart, int count) { | 8 void copyFrom(Array<Object> src, int srcStart, int dstStart, int count) { |
| 9 Arrays.copy(src, srcStart, this, dstStart, count); | 9 Arrays.copy(src, srcStart, this, dstStart, count); |
| 10 } | 10 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 throw new IndexOutOfRangeException(start); | 48 throw new IndexOutOfRangeException(start); |
| 49 } | 49 } |
| 50 if (this.length + length >= backingArray.length) { | 50 if (this.length + length >= backingArray.length) { |
| 51 grow(backingArray.length + length); | 51 grow(backingArray.length + length); |
| 52 } | 52 } |
| 53 Arrays.copy(backingArray, | 53 Arrays.copy(backingArray, |
| 54 start, | 54 start, |
| 55 backingArray, | 55 backingArray, |
| 56 start + length, | 56 start + length, |
| 57 this.length - start); | 57 this.length - start); |
| 58 print(backingArray[2]); | |
| 59 if (initialValue !== null) { | 58 if (initialValue !== null) { |
| 60 for (int i = start; i < start + length; i++) { | 59 for (int i = start; i < start + length; i++) { |
| 61 backingArray[i] = initialValue; | 60 backingArray[i] = initialValue; |
| 62 } | 61 } |
| 63 } | 62 } |
| 64 this.length = this.length + length; | 63 this.length = this.length + length; |
| 65 } | 64 } |
| 66 | 65 |
| 67 List<T> getRange(int start, int length) { | 66 List<T> getRange(int start, int length) { |
| 68 if (length == 0) return []; | 67 if (length == 0) return []; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 if (!hasNext()) { | 233 if (!hasNext()) { |
| 235 throw const NoMoreElementsException(); | 234 throw const NoMoreElementsException(); |
| 236 } | 235 } |
| 237 return _array[_pos++]; | 236 return _array[_pos++]; |
| 238 } | 237 } |
| 239 | 238 |
| 240 final GrowableObjectArray<T> _array; | 239 final GrowableObjectArray<T> _array; |
| 241 int _pos; | 240 int _pos; |
| 242 } | 241 } |
| 243 | 242 |
| OLD | NEW |