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 org_dartlang_compiler_util; | 5 part of org_dartlang_compiler_util; |
6 | 6 |
7 class Link<T> { | 7 class Link<T> extends IterableBase<T> implements Iterable<T> { |
Bob Nystrom
2013/06/26 01:03:24
I added this because I'm passing a Link<T> to Futu
ahe
2013/06/26 07:02:00
Nope, we don't support length.
Bob Nystrom
2013/06/27 00:38:18
Ah, that makes sense.
| |
8 T get head => null; | 8 T get head => null; |
9 Link<T> get tail => null; | 9 Link<T> get tail => null; |
10 | 10 |
11 factory Link.fromList(List<T> list) { | 11 factory Link.fromList(List<T> list) { |
12 switch (list.length) { | 12 switch (list.length) { |
13 case 0: | 13 case 0: |
14 return new Link<T>(); | 14 return new Link<T>(); |
15 case 1: | 15 case 1: |
16 return new LinkEntry<T>(list[0]); | 16 return new LinkEntry<T>(list[0]); |
17 case 2: | 17 case 2: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 * Prepends all elements added to the builder to [tail]. The resulting list is | 111 * Prepends all elements added to the builder to [tail]. The resulting list is |
112 * returned and the builder is cleared. | 112 * returned and the builder is cleared. |
113 */ | 113 */ |
114 Link<T> toLink([Link<T> tail = const Link()]); | 114 Link<T> toLink([Link<T> tail = const Link()]); |
115 | 115 |
116 void addLast(T t); | 116 void addLast(T t); |
117 | 117 |
118 final int length; | 118 final int length; |
119 final bool isEmpty; | 119 final bool isEmpty; |
120 } | 120 } |
OLD | NEW |