| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart.collection; | 5 part of dart.collection; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Abstract implementation of a list. | 8 * Abstract implementation of a list. |
| 9 * | 9 * |
| 10 * `ListBase` can be used as a base class for implementing the `List` interface. | 10 * `ListBase` can be used as a base class for implementing the `List` interface. |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 startIndex = 0; | 427 startIndex = 0; |
| 428 } | 428 } |
| 429 for (int i = startIndex; i < this.length; i++) { | 429 for (int i = startIndex; i < this.length; i++) { |
| 430 if (this[i] == element) { | 430 if (this[i] == element) { |
| 431 return i; | 431 return i; |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 return -1; | 434 return -1; |
| 435 } | 435 } |
| 436 | 436 |
| 437 /** | |
| 438 * Returns the last index in the list [a] of the given [element], starting | |
| 439 * the search at index [startIndex] to 0. | |
| 440 * Returns -1 if [element] is not found. | |
| 441 */ | |
| 442 int lastIndexOf(Object element, [int startIndex]) { | 437 int lastIndexOf(Object element, [int startIndex]) { |
| 443 if (startIndex == null) { | 438 if (startIndex == null) { |
| 444 startIndex = this.length - 1; | 439 startIndex = this.length - 1; |
| 445 } else { | 440 } else { |
| 446 if (startIndex < 0) { | 441 if (startIndex < 0) { |
| 447 return -1; | 442 return -1; |
| 448 } | 443 } |
| 449 if (startIndex >= this.length) { | 444 if (startIndex >= this.length) { |
| 450 startIndex = this.length - 1; | 445 startIndex = this.length - 1; |
| 451 } | 446 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 for (E element in iterable) { | 502 for (E element in iterable) { |
| 508 this[index++] = element; | 503 this[index++] = element; |
| 509 } | 504 } |
| 510 } | 505 } |
| 511 } | 506 } |
| 512 | 507 |
| 513 Iterable<E> get reversed => new ReversedListIterable<E>(this); | 508 Iterable<E> get reversed => new ReversedListIterable<E>(this); |
| 514 | 509 |
| 515 String toString() => IterableBase.iterableToFullString(this, '[', ']'); | 510 String toString() => IterableBase.iterableToFullString(this, '[', ']'); |
| 516 } | 511 } |
| OLD | NEW |