| 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 class LinkIterator<T> implements Iterator<T> { | 5 class LinkIterator<T> implements Iterator<T> { |
| 6 Link<T> current; | 6 Link<T> current; |
| 7 LinkIterator(Link<T> this.current); | 7 LinkIterator(Link<T> this.current); |
| 8 bool hasNext() => !current.isEmpty(); | 8 bool hasNext() => !current.isEmpty(); |
| 9 T next() { | 9 T next() { |
| 10 T result = current.head; | 10 T result = current.head; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 void printOn(StringBuffer buffer, [separatedBy]) { | 56 void printOn(StringBuffer buffer, [separatedBy]) { |
| 57 } | 57 } |
| 58 | 58 |
| 59 String toString() => "[]"; | 59 String toString() => "[]"; |
| 60 | 60 |
| 61 Link<T> reverse() => this; | 61 Link<T> reverse() => this; |
| 62 | 62 |
| 63 Link<T> reversePrependAll(Link<T> from) { | 63 Link<T> reversePrependAll(Link<T> from) { |
| 64 if (from.isEmpty()) return this; | 64 if (from.isEmpty()) return this; |
| 65 return from.head.reversePrependAll(from.tail); | 65 return this.prepend(from.head).reversePrependAll(from.tail); |
| 66 } | 66 } |
| 67 | 67 |
| 68 List toList() => const []; | 68 List toList() => const []; |
| 69 | 69 |
| 70 bool isEmpty() => true; | 70 bool isEmpty() => true; |
| 71 | 71 |
| 72 void forEach(void f(T element)) {} | 72 void forEach(void f(T element)) {} |
| 73 } | 73 } |
| 74 | 74 |
| 75 class LinkEntry<T> implements Link<T> { | 75 class LinkEntry<T> implements Link<T> { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 length++; | 156 length++; |
| 157 LinkEntry<T> entry = new LinkEntry<T>(t, null); | 157 LinkEntry<T> entry = new LinkEntry<T>(t, null); |
| 158 if (head === null) { | 158 if (head === null) { |
| 159 head = entry; | 159 head = entry; |
| 160 } else { | 160 } else { |
| 161 lastLink.tail = entry; | 161 lastLink.tail = entry; |
| 162 } | 162 } |
| 163 lastLink = entry; | 163 lastLink = entry; |
| 164 } | 164 } |
| 165 } | 165 } |
| OLD | NEW |