| 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 ArrayFactory { | 5 class ArrayFactory { |
| 6 factory Array<E>.from(Iterable<E> other) { | 6 factory Array<E>.from(Iterable<E> other) { |
| 7 Array<E> array = new Array<E>(); | 7 Array<E> array = new Array<E>(); |
| 8 for (final e in other) { | 8 for (final e in other) { |
| 9 array.add(e); | 9 array.add(e); |
| 10 } | 10 } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 throw new IndexOutOfRangeException(start + length); | 182 throw new IndexOutOfRangeException(start + length); |
| 183 } | 183 } |
| 184 _splice(start, length); | 184 _splice(start, length); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void insertRange(int start, int length, [T initialValue = null]) { | 187 void insertRange(int start, int length, [T initialValue = null]) { |
| 188 throw const NotImplementedException(); | 188 throw const NotImplementedException(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 List<T> getRange(int start, int length) { | 191 List<T> getRange(int start, int length) { |
| 192 throw const NotImplementedException(); | 192 if (length == 0) return []; |
| 193 Arrays.rangeCheck(this, start, length); |
| 194 return new List<T>.fromList(this, start, start + length); |
| 193 } | 195 } |
| 194 | 196 |
| 195 int indexOf(T element, int startIndex) { | 197 int indexOf(T element, int startIndex) { |
| 196 return Arrays.indexOf(this, element, startIndex, this.length); | 198 return Arrays.indexOf(this, element, startIndex, this.length); |
| 197 } | 199 } |
| 198 | 200 |
| 199 int lastIndexOf(T element, int startIndex) { | 201 int lastIndexOf(T element, int startIndex) { |
| 200 return Arrays.lastIndexOf(this, element, startIndex); | 202 return Arrays.lastIndexOf(this, element, startIndex); |
| 201 } | 203 } |
| 202 | 204 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 305 } |
| 304 | 306 |
| 305 static Array _newArray(int len) native { | 307 static Array _newArray(int len) native { |
| 306 return new Array(len); | 308 return new Array(len); |
| 307 } | 309 } |
| 308 | 310 |
| 309 static void _throwIndexOutOfRangeException(int index) native { | 311 static void _throwIndexOutOfRangeException(int index) native { |
| 310 throw new IndexOutOfRangeException(index); | 312 throw new IndexOutOfRangeException(index); |
| 311 } | 313 } |
| 312 } | 314 } |
| OLD | NEW |