OLD | NEW |
1 part of dart.collection; | 1 part of dart.collection; |
2 abstract class SetMixin<E> implements Set<E> {bool add(E element); | 2 abstract class SetMixin<E> implements Set<E> {bool add(E element); |
3 bool contains(Object element); | 3 bool contains(Object element); |
4 E lookup(E element); | 4 E lookup(E element); |
5 bool remove(Object element); | 5 bool remove(Object element); |
6 Iterator<E> get iterator; | 6 Iterator<E> get iterator; |
7 Set<E> toSet(); | 7 Set<E> toSet(); |
8 int get length; | 8 int get length; |
9 bool get isEmpty => length == 0; | 9 bool get isEmpty => length == 0; |
10 bool get isNotEmpty => length != 0; | 10 bool get isNotEmpty => length != 0; |
(...skipping 11 matching lines...) Expand all Loading... |
22 for (Object o in elements) { | 22 for (Object o in elements) { |
23 toRemove.remove(o); | 23 toRemove.remove(o); |
24 } | 24 } |
25 removeAll(toRemove); | 25 removeAll(toRemove); |
26 } | 26 } |
27 void removeWhere(bool test(E element)) { | 27 void removeWhere(bool test(E element)) { |
28 List toRemove = []; | 28 List toRemove = []; |
29 for (E element in this) { | 29 for (E element in this) { |
30 if (test(element)) toRemove.add(element); | 30 if (test(element)) toRemove.add(element); |
31 } | 31 } |
32 removeAll(DDC$RT.cast(toRemove, DDC$RT.type((List<dynamic> _) { | 32 removeAll(DEVC$RT.cast(toRemove, DEVC$RT.type((List<dynamic> _) { |
33 } | 33 } |
34 ), DDC$RT.type((Iterable<Object> _) { | 34 ), DEVC$RT.type((Iterable<Object> _) { |
35 } | 35 } |
36 ), "CastDynamic", """line 77, column 15 of dart:collection/set.dart: """, toRe
move is Iterable<Object>, false)); | 36 ), "CastDynamic", """line 77, column 15 of dart:collection/set.dart: """, toRe
move is Iterable<Object>, false)); |
37 } | 37 } |
38 void retainWhere(bool test(E element)) { | 38 void retainWhere(bool test(E element)) { |
39 List toRemove = []; | 39 List toRemove = []; |
40 for (E element in this) { | 40 for (E element in this) { |
41 if (!test(element)) toRemove.add(element); | 41 if (!test(element)) toRemove.add(element); |
42 } | 42 } |
43 removeAll(DDC$RT.cast(toRemove, DDC$RT.type((List<dynamic> _) { | 43 removeAll(DEVC$RT.cast(toRemove, DEVC$RT.type((List<dynamic> _) { |
44 } | 44 } |
45 ), DDC$RT.type((Iterable<Object> _) { | 45 ), DEVC$RT.type((Iterable<Object> _) { |
46 } | 46 } |
47 ), "CastDynamic", """line 85, column 15 of dart:collection/set.dart: """, toRe
move is Iterable<Object>, false)); | 47 ), "CastDynamic", """line 85, column 15 of dart:collection/set.dart: """, toRe
move is Iterable<Object>, false)); |
48 } | 48 } |
49 bool containsAll(Iterable<Object> other) { | 49 bool containsAll(Iterable<Object> other) { |
50 for (Object o in other) { | 50 for (Object o in other) { |
51 if (!contains(o)) return false; | 51 if (!contains(o)) return false; |
52 } | 52 } |
53 return true; | 53 return true; |
54 } | 54 } |
55 Set<E> union(Set<E> other) { | 55 Set<E> union(Set<E> other) { |
(...skipping 19 matching lines...) Expand all Loading... |
75 List<E> result = growable ? (new List<E>()..length = length) : new List<E>(len
gth); | 75 List<E> result = growable ? (new List<E>()..length = length) : new List<E>(len
gth); |
76 int i = 0; | 76 int i = 0; |
77 for (E element in this) result[i++] = element; | 77 for (E element in this) result[i++] = element; |
78 return result; | 78 return result; |
79 } | 79 } |
80 Iterable map(f(E element)) => new EfficientLengthMappedIterable<E, dynamic>(thi
s, f); | 80 Iterable map(f(E element)) => new EfficientLengthMappedIterable<E, dynamic>(thi
s, f); |
81 E get single { | 81 E get single { |
82 if (length > 1) throw IterableElementError.tooMany(); | 82 if (length > 1) throw IterableElementError.tooMany(); |
83 Iterator it = iterator; | 83 Iterator it = iterator; |
84 if (!it.moveNext()) throw IterableElementError.noElement(); | 84 if (!it.moveNext()) throw IterableElementError.noElement(); |
85 E result = DDC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 130, co
lumn 16 of dart:collection/set.dart: """, it.current is E, false); | 85 E result = DEVC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 130, c
olumn 16 of dart:collection/set.dart: """, it.current is E, false); |
86 return result; | 86 return result; |
87 } | 87 } |
88 String toString() => IterableBase.iterableToFullString(this, '{', '}'); | 88 String toString() => IterableBase.iterableToFullString(this, '{', '}'); |
89 Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f); | 89 Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f); |
90 Iterable expand(Iterable f(E element)) => new ExpandIterable<E, dynamic>(this,
f); | 90 Iterable expand(Iterable f(E element)) => new ExpandIterable<E, dynamic>(this,
f); |
91 void forEach(void f(E element)) { | 91 void forEach(void f(E element)) { |
92 for (E element in this) f(element); | 92 for (E element in this) f(element); |
93 } | 93 } |
94 E reduce(E combine(E value, E element)) { | 94 E reduce(E combine(E value, E element)) { |
95 Iterator<E> iterator = this.iterator; | 95 Iterator<E> iterator = this.iterator; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 return new SkipIterable<E>(this, n); | 147 return new SkipIterable<E>(this, n); |
148 } | 148 } |
149 Iterable<E> skipWhile(bool test(E value)) { | 149 Iterable<E> skipWhile(bool test(E value)) { |
150 return new SkipWhileIterable<E>(this, test); | 150 return new SkipWhileIterable<E>(this, test); |
151 } | 151 } |
152 E get first { | 152 E get first { |
153 Iterator it = iterator; | 153 Iterator it = iterator; |
154 if (!it.moveNext()) { | 154 if (!it.moveNext()) { |
155 throw IterableElementError.noElement(); | 155 throw IterableElementError.noElement(); |
156 } | 156 } |
157 return DDC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 220, column
12 of dart:collection/set.dart: """, it.current is E, false); | 157 return DEVC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 220, colum
n 12 of dart:collection/set.dart: """, it.current is E, false); |
158 } | 158 } |
159 E get last { | 159 E get last { |
160 Iterator it = iterator; | 160 Iterator it = iterator; |
161 if (!it.moveNext()) { | 161 if (!it.moveNext()) { |
162 throw IterableElementError.noElement(); | 162 throw IterableElementError.noElement(); |
163 } | 163 } |
164 E result; | 164 E result; |
165 do { | 165 do { |
166 result = DDC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 230, col
umn 16 of dart:collection/set.dart: """, it.current is E, false); | 166 result = DEVC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 230, co
lumn 16 of dart:collection/set.dart: """, it.current is E, false); |
167 } | 167 } |
168 while (it.moveNext()); return result; | 168 while (it.moveNext()); return result; |
169 } | 169 } |
170 E firstWhere(bool test(E value), { | 170 E firstWhere(bool test(E value), { |
171 E orElse()} | 171 E orElse()} |
172 ) { | 172 ) { |
173 for (E element in this) { | 173 for (E element in this) { |
174 if (test(element)) return element; | 174 if (test(element)) return element; |
175 } | 175 } |
176 if (orElse != null) return orElse(); | 176 if (orElse != null) return orElse(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 int elementIndex = 0; | 212 int elementIndex = 0; |
213 for (E element in this) { | 213 for (E element in this) { |
214 if (index == elementIndex) return element; | 214 if (index == elementIndex) return element; |
215 elementIndex++; | 215 elementIndex++; |
216 } | 216 } |
217 throw new RangeError.index(index, this, "index", null, elementIndex); | 217 throw new RangeError.index(index, this, "index", null, elementIndex); |
218 } | 218 } |
219 } | 219 } |
220 abstract class SetBase<E> extends SetMixin<E> {static String setToString(Set se
t) => IterableBase.iterableToFullString(set, '{', '}'); | 220 abstract class SetBase<E> extends SetMixin<E> {static String setToString(Set se
t) => IterableBase.iterableToFullString(set, '{', '}'); |
221 } | 221 } |
OLD | NEW |