| 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 dart2js.util; | 5 part of dart2js.util; |
| 6 | 6 |
| 7 class Link<T> { | 7 class Link<T> { |
| 8 T get head => throw new StateError("no elements"); | 8 T get head => throw new StateError("no elements"); |
| 9 Link<T> get tail => null; | 9 Link<T> get tail => null; |
| 10 | 10 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 /// Returns true if f returns true for all elements of this list. | 121 /// Returns true if f returns true for all elements of this list. |
| 122 /// | 122 /// |
| 123 /// Returns true for the empty list. | 123 /// Returns true for the empty list. |
| 124 bool every(bool f(T)) { | 124 bool every(bool f(T)) { |
| 125 for (Link<T> link = this; !link.isEmpty; link = link.tail){ | 125 for (Link<T> link = this; !link.isEmpty; link = link.tail){ |
| 126 if (!f(link.head)) return false; | 126 if (!f(link.head)) return false; |
| 127 } | 127 } |
| 128 return true; | 128 return true; |
| 129 } | 129 } |
| 130 |
| 131 Link copyWithout(e) => this; |
| 130 } | 132 } |
| 131 | 133 |
| 132 abstract class LinkBuilder<T> { | 134 abstract class LinkBuilder<T> { |
| 133 factory LinkBuilder() = LinkBuilderImplementation; | 135 factory LinkBuilder() = LinkBuilderImplementation; |
| 134 | 136 |
| 135 /** | 137 /** |
| 136 * Prepends all elements added to the builder to [tail]. The resulting list is | 138 * Prepends all elements added to the builder to [tail]. The resulting list is |
| 137 * returned and the builder is cleared. | 139 * returned and the builder is cleared. |
| 138 */ | 140 */ |
| 139 Link<T> toLink([Link<T> tail = const Link()]); | 141 Link<T> toLink([Link<T> tail = const Link()]); |
| 140 | 142 |
| 141 List<T> toList(); | 143 List<T> toList(); |
| 142 | 144 |
| 143 void addLast(T t); | 145 void addLast(T t); |
| 144 | 146 |
| 145 final int length; | 147 final int length; |
| 146 final bool isEmpty; | 148 final bool isEmpty; |
| 147 } | 149 } |
| OLD | NEW |