| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if (!f(element)) return false; | 112 if (!f(element)) return false; |
| 113 } | 113 } |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 String join([String separator = ""]) { | 116 String join([String separator = ""]) { |
| 117 Iterator<E> iterator = this.iterator; | 117 Iterator<E> iterator = this.iterator; |
| 118 if (!iterator.moveNext()) return ""; | 118 if (!iterator.moveNext()) return ""; |
| 119 StringBuffer buffer = new StringBuffer(); | 119 StringBuffer buffer = new StringBuffer(); |
| 120 if (separator == null || separator == "") { | 120 if (separator == null || separator == "") { |
| 121 do { | 121 do { |
| 122 buffer.write("${iterator.current} | 122 buffer.write("${iterator.current}"); |
| 123 "); | 123 } |
| 124 while (iterator.moveNext());} |
| 125 else { |
| 126 buffer.write("${iterator.current}"); |
| 127 while (iterator.moveNext()) { |
| 128 buffer.write(separator); |
| 129 buffer.write("${iterator.current}"); |
| 130 } |
| 124 } | 131 } |
| 125 while (iterator.moveNext());} | 132 return buffer.toString(); |
| 126 else { | 133 } |
| 127 buffer.write("${iterator.current} | |
| 128 "); | |
| 129 while (iterator.moveNext()) { | |
| 130 buffer.write(separator); | |
| 131 buffer.write("${iterator.current} | |
| 132 "); | |
| 133 } | |
| 134 } | |
| 135 return buffer.toString(); | |
| 136 } | |
| 137 bool any(bool test(E element)) { | 134 bool any(bool test(E element)) { |
| 138 for (E element in this) { | 135 for (E element in this) { |
| 139 if (test(element)) return true; | 136 if (test(element)) return true; |
| 140 } | 137 } |
| 141 return false; | 138 return false; |
| 142 } | 139 } |
| 143 Iterable<E> take(int n) { | 140 Iterable<E> take(int n) { |
| 144 return new TakeIterable<E>(this, n); | 141 return new TakeIterable<E>(this, n); |
| 145 } | 142 } |
| 146 Iterable<E> takeWhile(bool test(E value)) { | 143 Iterable<E> takeWhile(bool test(E value)) { |
| 147 return new TakeWhileIterable<E>(this, test); | 144 return new TakeWhileIterable<E>(this, test); |
| 148 } | 145 } |
| 149 Iterable<E> skip(int n) { | 146 Iterable<E> skip(int n) { |
| 150 return new SkipIterable<E>(this, n); | 147 return new SkipIterable<E>(this, n); |
| 151 } | 148 } |
| 152 Iterable<E> skipWhile(bool test(E value)) { | 149 Iterable<E> skipWhile(bool test(E value)) { |
| 153 return new SkipWhileIterable<E>(this, test); | 150 return new SkipWhileIterable<E>(this, test); |
| 154 } | 151 } |
| 155 E get first { | 152 E get first { |
| 156 Iterator it = iterator; | 153 Iterator it = iterator; |
| 157 if (!it.moveNext()) { | 154 if (!it.moveNext()) { |
| 158 throw IterableElementError.noElement(); | 155 throw IterableElementError.noElement(); |
| 159 } | 156 } |
| 160 return DDC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 220, column 1
2 of dart:collection/set.dart: """, it.current is E, false); | 157 return DDC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 220, column
12 of dart:collection/set.dart: """, it.current is E, false); |
| 161 } | 158 } |
| 162 E get last { | 159 E get last { |
| 163 Iterator it = iterator; | 160 Iterator it = iterator; |
| 164 if (!it.moveNext()) { | 161 if (!it.moveNext()) { |
| 165 throw IterableElementError.noElement(); | 162 throw IterableElementError.noElement(); |
| 166 } | 163 } |
| 167 E result; | 164 E result; |
| 168 do { | 165 do { |
| 169 result = DDC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 230, column
16 of dart:collection/set.dart: """, it.current is E, false); | 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); |
| 170 } | 167 } |
| 171 while (it.moveNext()); return result; | 168 while (it.moveNext()); return result; |
| 172 } | 169 } |
| 173 E firstWhere(bool test(E value), { | 170 E firstWhere(bool test(E value), { |
| 174 E orElse()} | 171 E orElse()} |
| 175 ) { | 172 ) { |
| 176 for (E element in this) { | 173 for (E element in this) { |
| 177 if (test(element)) return element; | 174 if (test(element)) return element; |
| 178 } | 175 } |
| 179 if (orElse != null) return orElse(); | 176 if (orElse != null) return orElse(); |
| 180 throw IterableElementError.noElement(); | 177 throw IterableElementError.noElement(); |
| 181 } | 178 } |
| 182 E lastWhere(bool test(E value), { | 179 E lastWhere(bool test(E value), { |
| 183 E orElse()} | 180 E orElse()} |
| 184 ) { | 181 ) { |
| 185 E result = ((__x43) => DDC$RT.cast(__x43, Null, E, "CastLiteral", """line 244, c
olumn 16 of dart:collection/set.dart: """, __x43 is E, false))(null); | 182 E result = ((__x43) => DDC$RT.cast(__x43, Null, E, "CastLiteral", """line 244,
column 16 of dart:collection/set.dart: """, __x43 is E, false))(null); |
| 186 bool foundMatching = false; | 183 bool foundMatching = false; |
| 187 for (E element in this) { | 184 for (E element in this) { |
| 188 if (test(element)) { | 185 if (test(element)) { |
| 189 result = element; | 186 result = element; |
| 190 foundMatching = true; | 187 foundMatching = true; |
| 191 } | 188 } |
| 192 } | 189 } |
| 193 if (foundMatching) return result; | 190 if (foundMatching) return result; |
| 194 if (orElse != null) return orElse(); | 191 if (orElse != null) return orElse(); |
| 195 throw IterableElementError.noElement(); | 192 throw IterableElementError.noElement(); |
| 196 } | 193 } |
| 197 E singleWhere(bool test(E value)) { | 194 E singleWhere(bool test(E value)) { |
| 198 E result = ((__x44) => DDC$RT.cast(__x44, Null, E, "CastLiteral", """line 258, c
olumn 16 of dart:collection/set.dart: """, __x44 is E, false))(null); | 195 E result = ((__x44) => DDC$RT.cast(__x44, Null, E, "CastLiteral", """line 258,
column 16 of dart:collection/set.dart: """, __x44 is E, false))(null); |
| 199 bool foundMatching = false; | 196 bool foundMatching = false; |
| 200 for (E element in this) { | 197 for (E element in this) { |
| 201 if (test(element)) { | 198 if (test(element)) { |
| 202 if (foundMatching) { | 199 if (foundMatching) { |
| 203 throw IterableElementError.tooMany(); | 200 throw IterableElementError.tooMany(); |
| 201 } |
| 202 result = element; |
| 203 foundMatching = true; |
| 204 } |
| 205 } |
| 206 if (foundMatching) return result; |
| 207 throw IterableElementError.noElement(); |
| 204 } | 208 } |
| 205 result = element; | |
| 206 foundMatching = true; | |
| 207 } | |
| 208 } | |
| 209 if (foundMatching) return result; | |
| 210 throw IterableElementError.noElement(); | |
| 211 } | |
| 212 E elementAt(int index) { | 209 E elementAt(int index) { |
| 213 if (index is! int) throw new ArgumentError.notNull("index"); | 210 if (index is! int) throw new ArgumentError.notNull("index"); |
| 214 RangeError.checkNotNegative(index, "index"); | 211 RangeError.checkNotNegative(index, "index"); |
| 215 int elementIndex = 0; | 212 int elementIndex = 0; |
| 216 for (E element in this) { | 213 for (E element in this) { |
| 217 if (index == elementIndex) return element; | 214 if (index == elementIndex) return element; |
| 218 elementIndex++; | 215 elementIndex++; |
| 219 } | 216 } |
| 220 throw new RangeError.index(index, this, "index", null, elementIndex); | 217 throw new RangeError.index(index, this, "index", null, elementIndex); |
| 221 } | 218 } |
| 222 } | 219 } |
| 223 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, '{', '}'); |
| 224 } | 221 } |
| OLD | NEW |