OLD | NEW |
1 part of dart.core; | 1 part of dart.core; |
2 abstract class Iterable<E> {const Iterable(); | 2 abstract class Iterable<E> {const Iterable(); |
3 factory Iterable.generate(int count, [E generator(int index)]) { | 3 factory Iterable.generate(int count, [E generator(int index)]) { |
4 if (count <= 0) return new EmptyIterable<E>(); | 4 if (count <= 0) return new EmptyIterable<E>(); |
5 return new _GeneratorIterable<E>(count, generator); | 5 return new _GeneratorIterable<E>(count, generator); |
6 } | 6 } |
7 Iterator<E> get iterator; | 7 Iterator<E> get iterator; |
8 Iterable map(f(E element)); | 8 Iterable map(f(E element)); |
9 Iterable<E> where(bool test(E element)); | 9 Iterable<E> where(bool test(E element)); |
10 Iterable expand(Iterable f(E element)); | 10 Iterable expand(Iterable f(E element)); |
(...skipping 28 matching lines...) Expand all Loading... |
39 E lastWhere(bool test(E element), { | 39 E lastWhere(bool test(E element), { |
40 E orElse()} | 40 E orElse()} |
41 ); | 41 ); |
42 E singleWhere(bool test(E element)); | 42 E singleWhere(bool test(E element)); |
43 E elementAt(int index); | 43 E elementAt(int index); |
44 } | 44 } |
45 typedef E _Generator<E>(int index); | 45 typedef E _Generator<E>(int index); |
46 class _GeneratorIterable<E> extends IterableBase<E> implements EfficientLength
{final int _start; | 46 class _GeneratorIterable<E> extends IterableBase<E> implements EfficientLength
{final int _start; |
47 final int _end; | 47 final int _end; |
48 final _Generator<E> _generator; | 48 final _Generator<E> _generator; |
49 _GeneratorIterable(this._end, E generator(int n)) : _start = 0, _generator = ((
__x10) => DDC$RT.cast(__x10, dynamic, DDC$RT.type((__t8<E> _) { | 49 _GeneratorIterable(this._end, E generator(int n)) : _start = 0, _generator = ((
__x10) => DEVC$RT.cast(__x10, dynamic, DEVC$RT.type((__t8<E> _) { |
50 } | 50 } |
51 ), "CastGeneral", """line 319, column 22 of dart:core/iterable.dart: """, __x10
is __t8<E>, false))((generator != null) ? generator : _id); | 51 ), "CastGeneral", """line 319, column 22 of dart:core/iterable.dart: """, __x10
is __t8<E>, false))((generator != null) ? generator : _id); |
52 _GeneratorIterable.slice(this._start, this._end, this._generator); | 52 _GeneratorIterable.slice(this._start, this._end, this._generator); |
53 Iterator<E> get iterator => new _GeneratorIterator<E>(_start, _end, _generator)
; | 53 Iterator<E> get iterator => new _GeneratorIterator<E>(_start, _end, _generator)
; |
54 int get length => _end - _start; | 54 int get length => _end - _start; |
55 Iterable<E> skip(int count) { | 55 Iterable<E> skip(int count) { |
56 RangeError.checkNotNegative(count, "count"); | 56 RangeError.checkNotNegative(count, "count"); |
57 if (count == 0) return this; | 57 if (count == 0) return this; |
58 int newStart = _start + count; | 58 int newStart = _start + count; |
59 if (newStart >= _end) return new EmptyIterable<E>(); | 59 if (newStart >= _end) return new EmptyIterable<E>(); |
(...skipping 22 matching lines...) Expand all Loading... |
82 else { | 82 else { |
83 _current = null; | 83 _current = null; |
84 return false; | 84 return false; |
85 } | 85 } |
86 } | 86 } |
87 E get current => _current; | 87 E get current => _current; |
88 } | 88 } |
89 abstract class BidirectionalIterator<E> implements Iterator<E> {bool movePrevio
us(); | 89 abstract class BidirectionalIterator<E> implements Iterator<E> {bool movePrevio
us(); |
90 } | 90 } |
91 typedef E __t8<E>(int __u9); | 91 typedef E __t8<E>(int __u9); |
OLD | NEW |