OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of _interceptors; | 5 part of _interceptors; |
6 | 6 |
7 /** | 7 /** |
8 * The interceptor class for [List]. The compiler recognizes this | 8 * The interceptor class for [List]. The compiler recognizes this |
9 * class as an interceptor, and changes references to [:this:] to | 9 * class as an interceptor, and changes references to [:this:] to |
10 * actually use the receiver of the method, which is generated as an extra | 10 * actually use the receiver of the method, which is generated as an extra |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 bool contains(E other) { | 241 bool contains(E other) { |
242 for (int i = 0; i < length; i++) { | 242 for (int i = 0; i < length; i++) { |
243 if (other == this[i]) return true; | 243 if (other == this[i]) return true; |
244 } | 244 } |
245 return false; | 245 return false; |
246 } | 246 } |
247 | 247 |
248 bool get isEmpty => length == 0; | 248 bool get isEmpty => length == 0; |
249 | 249 |
| 250 bool get isNotEmpty => !isEmpty; |
| 251 |
250 String toString() => ToString.iterableToString(this); | 252 String toString() => ToString.iterableToString(this); |
251 | 253 |
252 List<E> toList({ bool growable: true }) => | 254 List<E> toList({ bool growable: true }) => |
253 new List<E>.from(this, growable: growable); | 255 new List<E>.from(this, growable: growable); |
254 | 256 |
255 Set<E> toSet() => new Set<E>.from(this); | 257 Set<E> toSet() => new Set<E>.from(this); |
256 | 258 |
257 Iterator<E> get iterator => new ListIterator<E>(this); | 259 Iterator<E> get iterator => new ListIterator<E>(this); |
258 | 260 |
259 int get hashCode => Primitives.objectHashCode(this); | 261 int get hashCode => Primitives.objectHashCode(this); |
(...skipping 25 matching lines...) Expand all Loading... |
285 } | 287 } |
286 } | 288 } |
287 | 289 |
288 /** | 290 /** |
289 * Dummy subclasses that allow the backend to track more precise | 291 * Dummy subclasses that allow the backend to track more precise |
290 * information about arrays through their type. | 292 * information about arrays through their type. |
291 */ | 293 */ |
292 class JSMutableArray extends JSArray implements JSMutableIndexable {} | 294 class JSMutableArray extends JSArray implements JSMutableIndexable {} |
293 class JSFixedArray extends JSMutableArray {} | 295 class JSFixedArray extends JSMutableArray {} |
294 class JSExtendableArray extends JSMutableArray {} | 296 class JSExtendableArray extends JSMutableArray {} |
OLD | NEW |