| 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 /** | 8 /** |
| 9 * A specialized double-linked list of elements that extends [LinkedListEntry]. | 9 * A specialized double-linked list of elements that extends [LinkedListEntry]. |
| 10 * | 10 * |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * | 22 * |
| 23 * In return, each element knows its own place in the linked list, as well as | 23 * In return, each element knows its own place in the linked list, as well as |
| 24 * which list it is in. This allows constant time [LinkedListEntry.addAfter], | 24 * which list it is in. This allows constant time [LinkedListEntry.addAfter], |
| 25 * [LinkedListEntry.addBefore] and [LinkedListEntry.unlink] operations | 25 * [LinkedListEntry.addBefore] and [LinkedListEntry.unlink] operations |
| 26 * when all you have is the element. | 26 * when all you have is the element. |
| 27 * | 27 * |
| 28 * A `LinkedList` also allows constant time adding and removing at either end, | 28 * A `LinkedList` also allows constant time adding and removing at either end, |
| 29 * and a constant time length getter. | 29 * and a constant time length getter. |
| 30 */ | 30 */ |
| 31 class LinkedList<E extends LinkedListEntry<E>> | 31 class LinkedList<E extends LinkedListEntry<E>> |
| 32 extends IterableBase<E> | 32 extends Iterable<E> |
| 33 implements _LinkedListLink { | 33 implements _LinkedListLink { |
| 34 | 34 |
| 35 int _modificationCount = 0; | 35 int _modificationCount = 0; |
| 36 int _length = 0; | 36 int _length = 0; |
| 37 _LinkedListLink _next; | 37 _LinkedListLink _next; |
| 38 _LinkedListLink _previous; | 38 _LinkedListLink _previous; |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Construct a new empty linked list. | 41 * Construct a new empty linked list. |
| 42 */ | 42 */ |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 /** | 274 /** |
| 275 * Insert an element before this element in this element's linked list. | 275 * Insert an element before this element in this element's linked list. |
| 276 * | 276 * |
| 277 * This entry must be in a linked list when this method is called. | 277 * This entry must be in a linked list when this method is called. |
| 278 * The [entry] must not be in a linked list. | 278 * The [entry] must not be in a linked list. |
| 279 */ | 279 */ |
| 280 void insertBefore(E entry) { | 280 void insertBefore(E entry) { |
| 281 _list._insertAfter(_previous, entry); | 281 _list._insertAfter(_previous, entry); |
| 282 } | 282 } |
| 283 } | 283 } |
| OLD | NEW |