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; | |
6 | |
7 class Link<T> implements Iterable<T> { | 5 class Link<T> implements Iterable<T> { |
8 T get head => null; | 6 T get head => null; |
9 Link<T> get tail => null; | 7 Link<T> get tail => null; |
10 | 8 |
11 factory Link.fromList(List<T> list) { | 9 factory Link.fromList(List<T> list) { |
12 switch (list.length) { | 10 switch (list.length) { |
13 case 0: | 11 case 0: |
14 return new Link<T>(); | 12 return new Link<T>(); |
15 case 1: | 13 case 1: |
16 return new LinkEntry<T>(list[0]); | 14 return new LinkEntry<T>(list[0]); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 59 } |
62 | 60 |
63 interface LinkBuilder<T> default LinkBuilderImplementation<T> { | 61 interface LinkBuilder<T> default LinkBuilderImplementation<T> { |
64 LinkBuilder(); | 62 LinkBuilder(); |
65 | 63 |
66 Link<T> toLink(); | 64 Link<T> toLink(); |
67 void addLast(T t); | 65 void addLast(T t); |
68 | 66 |
69 final int length; | 67 final int length; |
70 } | 68 } |
OLD | NEW |