| 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 Link<T> implements Iterable<T> { | 5 class Link<T> implements Iterable<T> { |
| 6 T get head => null; | 6 T get head => null; |
| 7 Link<T> get tail => null; | 7 Link<T> get tail => null; |
| 8 | 8 |
| 9 factory Link.fromList(List<T> list) { | 9 factory Link.fromList(List<T> list) { |
| 10 switch (list.length) { | 10 switch (list.length) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 return new LinkEntry<T>(element, this); | 32 return new LinkEntry<T>(element, this); |
| 33 } | 33 } |
| 34 | 34 |
| 35 Iterator<T> iterator() => new LinkIterator<T>(this); | 35 Iterator<T> iterator() => new LinkIterator<T>(this); |
| 36 | 36 |
| 37 void printOn(StringBuffer buffer, [separatedBy]) { | 37 void printOn(StringBuffer buffer, [separatedBy]) { |
| 38 } | 38 } |
| 39 | 39 |
| 40 List toList() => new List<T>(0); | 40 List toList() => new List<T>(0); |
| 41 | 41 |
| 42 bool isEmpty() => true; | 42 bool get isEmpty => true; |
| 43 | 43 |
| 44 Link<T> reverse() => this; | 44 Link<T> reverse() => this; |
| 45 | 45 |
| 46 Link<T> reversePrependAll(Link<T> from) { | 46 Link<T> reversePrependAll(Link<T> from) { |
| 47 if (from.isEmpty()) return this; | 47 if (from.isEmpty) return this; |
| 48 return this.prepend(from.head).reversePrependAll(from.tail); | 48 return this.prepend(from.head).reversePrependAll(from.tail); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void forEach(void f(T element)) {} | 51 void forEach(void f(T element)) {} |
| 52 | 52 |
| 53 bool operator ==(other) { | 53 bool operator ==(other) { |
| 54 if (other is !Link<T>) return false; | 54 if (other is !Link<T>) return false; |
| 55 return other.isEmpty(); | 55 return other.isEmpty; |
| 56 } | 56 } |
| 57 | 57 |
| 58 String toString() => "[]"; | 58 String toString() => "[]"; |
| 59 } | 59 } |
| 60 | 60 |
| 61 interface LinkBuilder<T> default LinkBuilderImplementation<T> { | 61 interface LinkBuilder<T> default LinkBuilderImplementation<T> { |
| 62 LinkBuilder(); | 62 LinkBuilder(); |
| 63 | 63 |
| 64 Link<T> toLink(); | 64 Link<T> toLink(); |
| 65 void addLast(T t); | 65 void addLast(T t); |
| 66 | 66 |
| 67 final int length; | 67 final int length; |
| 68 } | 68 } |
| OLD | NEW |