| 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 dart.collection; | 5 part of dart.collection; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * This class provides default implementations for Iterables (including Lists). | 8 * This class provides default implementations for Iterables (including Lists). |
| 9 * | 9 * |
| 10 * Once Dart receives Mixins it will be replaced with mixin classes. | 10 * Once Dart receives Mixins it will be replaced with mixin classes. |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 298 |
| 299 static List skipList(List list, int n) { | 299 static List skipList(List list, int n) { |
| 300 // The generic type is currently lost. It will be fixed with mixins. | 300 // The generic type is currently lost. It will be fixed with mixins. |
| 301 return new ListView(list, n, null); | 301 return new ListView(list, n, null); |
| 302 } | 302 } |
| 303 | 303 |
| 304 static Iterable skipWhile(Iterable iterable, bool test(var value)) { | 304 static Iterable skipWhile(Iterable iterable, bool test(var value)) { |
| 305 // The generic type is currently lost. It will be fixed with mixins. | 305 // The generic type is currently lost. It will be fixed with mixins. |
| 306 return new SkipWhileIterable(iterable, test); | 306 return new SkipWhileIterable(iterable, test); |
| 307 } | 307 } |
| 308 |
| 309 static void sortList(List l, int compare(a, b)) { |
| 310 if (compare == null) compare = Comparable.compare; |
| 311 _Sort.sort(l, compare); |
| 312 } |
| 308 } | 313 } |
| 309 | 314 |
| 310 /** | 315 /** |
| 311 * The [Collections] class implements static methods useful when | 316 * The [Collections] class implements static methods useful when |
| 312 * writing a class that implements [Collection] and the [iterator] | 317 * writing a class that implements [Collection] and the [iterator] |
| 313 * method. | 318 * method. |
| 314 */ | 319 */ |
| 315 class Collections { | 320 class Collections { |
| 316 /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/ | 321 /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/ |
| 317 static bool contains(Iterable iterable, var element) | 322 static bool contains(Iterable iterable, var element) |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 * Returns true if the specified collection contains the specified object | 516 * Returns true if the specified collection contains the specified object |
| 512 * reference. | 517 * reference. |
| 513 */ | 518 */ |
| 514 static _containsRef(Collection c, Object ref) { | 519 static _containsRef(Collection c, Object ref) { |
| 515 for (var e in c) { | 520 for (var e in c) { |
| 516 if (identical(e, ref)) return true; | 521 if (identical(e, ref)) return true; |
| 517 } | 522 } |
| 518 return false; | 523 return false; |
| 519 } | 524 } |
| 520 } | 525 } |
| OLD | NEW |