| 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 part of html_common; | 5 part of html_common; |
| 6 | 6 |
| 7 class Lists { | 7 class Lists { |
| 8 | |
| 9 /** | 8 /** |
| 10 * Returns the index in the array [a] of the given [element], starting | 9 * Returns the index in the array [a] of the given [element], starting |
| 11 * the search at index [startIndex] to [endIndex] (exclusive). | 10 * the search at index [startIndex] to [endIndex] (exclusive). |
| 12 * Returns -1 if [element] is not found. | 11 * Returns -1 if [element] is not found. |
| 13 */ | 12 */ |
| 14 static int indexOf(List a, | 13 static int indexOf(List a, Object element, int startIndex, int endIndex) { |
| 15 Object element, | |
| 16 int startIndex, | |
| 17 int endIndex) { | |
| 18 if (startIndex >= a.length) { | 14 if (startIndex >= a.length) { |
| 19 return -1; | 15 return -1; |
| 20 } | 16 } |
| 21 if (startIndex < 0) { | 17 if (startIndex < 0) { |
| 22 startIndex = 0; | 18 startIndex = 0; |
| 23 } | 19 } |
| 24 for (int i = startIndex; i < endIndex; i++) { | 20 for (int i = startIndex; i < endIndex; i++) { |
| 25 if (a[i] == element) { | 21 if (a[i] == element) { |
| 26 return i; | 22 return i; |
| 27 } | 23 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return accumulator; | 62 return accumulator; |
| 67 } | 63 } |
| 68 } | 64 } |
| 69 | 65 |
| 70 /** | 66 /** |
| 71 * For accessing underlying node lists, for dart:js interop. | 67 * For accessing underlying node lists, for dart:js interop. |
| 72 */ | 68 */ |
| 73 abstract class NodeListWrapper { | 69 abstract class NodeListWrapper { |
| 74 List<Node> get rawList; | 70 List<Node> get rawList; |
| 75 } | 71 } |
| OLD | NEW |