| 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 linked list implementation, providing O(1) removal(unlink) of elements and | 9 * A linked list implementation, providing O(1) removal(unlink) of elements and |
| 10 * manual traversal through [next] and [previous]. | 10 * manual traversal through [next] and [previous]. |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 class _LinkedListLink { | 179 class _LinkedListLink { |
| 180 _LinkedListLink _next; | 180 _LinkedListLink _next; |
| 181 _LinkedListLink _previous; | 181 _LinkedListLink _previous; |
| 182 } | 182 } |
| 183 | 183 |
| 184 | 184 |
| 185 /** | 185 /** |
| 186 * Entry element for a [LinkedList]. Any entry must extend this class. | 186 * Entry element for a [LinkedList]. Any entry must extend this class. |
| 187 */ | 187 */ |
| 188 abstract class LinkedListEntry<E> implements _LinkedListLink { | 188 abstract class LinkedListEntry<E extends LinkedListEntry> |
| 189 implements _LinkedListLink { |
| 189 LinkedList<E> _list; | 190 LinkedList<E> _list; |
| 190 _LinkedListLink _next; | 191 _LinkedListLink _next; |
| 191 _LinkedListLink _previous; | 192 _LinkedListLink _previous; |
| 192 | 193 |
| 193 /** | 194 /** |
| 194 * Get the list containing this element. | 195 * Get the list containing this element. |
| 195 */ | 196 */ |
| 196 LinkedList<E> get list => _list; | 197 LinkedList<E> get list => _list; |
| 197 | 198 |
| 198 /** | 199 /** |
| (...skipping 26 matching lines...) Expand all Loading... |
| 225 _list._insertAfter(this, entry); | 226 _list._insertAfter(this, entry); |
| 226 } | 227 } |
| 227 | 228 |
| 228 /** | 229 /** |
| 229 * Insert an element before this. | 230 * Insert an element before this. |
| 230 */ | 231 */ |
| 231 void insertBefore(E entry) { | 232 void insertBefore(E entry) { |
| 232 _list._insertAfter(_previous, entry); | 233 _list._insertAfter(_previous, entry); |
| 233 } | 234 } |
| 234 } | 235 } |
| OLD | NEW |