| 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 util_implementation; | 5 part of util_implementation; |
| 6 | 6 |
| 7 class LinkIterator<T> implements Iterator<T> { | 7 class LinkIterator<T> implements Iterator<T> { |
| 8 T _current; | 8 T _current; |
| 9 Link<T> _link; | 9 Link<T> _link; |
| 10 | 10 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 while (!link.isEmpty) { | 173 while (!link.isEmpty) { |
| 174 list[index] = link.head; | 174 list[index] = link.head; |
| 175 link = link.tail; | 175 link = link.tail; |
| 176 index++; | 176 index++; |
| 177 } | 177 } |
| 178 lastLink = null; | 178 lastLink = null; |
| 179 head = null; | 179 head = null; |
| 180 return list; | 180 return list; |
| 181 } | 181 } |
| 182 | 182 |
| 183 void addLast(T t) { | 183 Link<T> addLast(T t) { |
| 184 length++; | 184 length++; |
| 185 LinkEntry<T> entry = new LinkEntry<T>(t, null); | 185 LinkEntry<T> entry = new LinkEntry<T>(t, null); |
| 186 if (head == null) { | 186 if (head == null) { |
| 187 head = entry; | 187 head = entry; |
| 188 } else { | 188 } else { |
| 189 lastLink.tail = entry; | 189 lastLink.tail = entry; |
| 190 } | 190 } |
| 191 lastLink = entry; | 191 lastLink = entry; |
| 192 return entry; |
| 192 } | 193 } |
| 193 | 194 |
| 194 bool get isEmpty => length == 0; | 195 bool get isEmpty => length == 0; |
| 195 } | 196 } |
| OLD | NEW |