Chromium Code Reviews| 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 LinkFactory { | 5 class LinkFactory<T> { |
|
regis
2011/11/11 01:11:07
Can you please add:
// TODO(regis): Move type par
srdjan
2011/11/11 01:18:11
With pleasure.
| |
| 6 factory Link(head, [Link tail]) { | 6 factory Link(head, [Link tail]) { |
| 7 return new LinkEntry(head, (tail === null) ? const LinkTail() : tail); | 7 return new LinkEntry(head, (tail === null) ? const LinkTail() : tail); |
| 8 } | 8 } |
| 9 | 9 |
| 10 factory Link.fromList(List list) { | 10 factory Link.fromList(List list) { |
| 11 switch (list.length) { | 11 switch (list.length) { |
| 12 case 0: | 12 case 0: |
| 13 return const LinkTail(); | 13 return const LinkTail(); |
| 14 case 1: | 14 case 1: |
| 15 return new Link(list[0]); | 15 return new Link(list[0]); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 void addLast(T t) { | 115 void addLast(T t) { |
| 116 LinkEntry<T> entry = new LinkEntry<T>(t, null); | 116 LinkEntry<T> entry = new LinkEntry<T>(t, null); |
| 117 if (head === null) { | 117 if (head === null) { |
| 118 head = entry; | 118 head = entry; |
| 119 } else { | 119 } else { |
| 120 lastLink.realTail = entry; | 120 lastLink.realTail = entry; |
| 121 } | 121 } |
| 122 lastLink = entry; | 122 lastLink = entry; |
| 123 } | 123 } |
| 124 } | 124 } |
| OLD | NEW |