| 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 10 matching lines...) Expand all  Loading... | 
|  21     Link link = new Link<T>(); |  21     Link link = new Link<T>(); | 
|  22     for (int i = list.length ; i > 0; i--) { |  22     for (int i = list.length ; i > 0; i--) { | 
|  23       link = link.prepend(list[i - 1]); |  23       link = link.prepend(list[i - 1]); | 
|  24     } |  24     } | 
|  25     return link; |  25     return link; | 
|  26   } |  26   } | 
|  27  |  27  | 
|  28   const Link(); |  28   const Link(); | 
|  29  |  29  | 
|  30   Link<T> prepend(T element) { |  30   Link<T> prepend(T element) { | 
|  31     // TODO(ahe): Use new Link<T>, but this cost 8% performance on VM. |  | 
|  32     return new LinkEntry<T>(element, this); |  31     return new LinkEntry<T>(element, this); | 
|  33   } |  32   } | 
|  34  |  33  | 
|  35   Iterator<T> iterator() => new LinkIterator<T>(this); |  34   Iterator<T> iterator() => new LinkIterator<T>(this); | 
|  36  |  35  | 
|  37   void printOn(StringBuffer buffer, [separatedBy]) { |  36   void printOn(StringBuffer buffer, [separatedBy]) { | 
|  38   } |  37   } | 
|  39  |  38  | 
|  40   List toList() => new List<T>(0); |  39   List toList() => new List<T>(0); | 
|  41  |  40  | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
|  59 } |  58 } | 
|  60  |  59  | 
|  61 interface LinkBuilder<T> default LinkBuilderImplementation<T> { |  60 interface LinkBuilder<T> default LinkBuilderImplementation<T> { | 
|  62   LinkBuilder(); |  61   LinkBuilder(); | 
|  63  |  62  | 
|  64   Link<T> toLink(); |  63   Link<T> toLink(); | 
|  65   void addLast(T t); |  64   void addLast(T t); | 
|  66  |  65  | 
|  67   final int length; |  66   final int length; | 
|  68 } |  67 } | 
| OLD | NEW |