OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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.core; | 5 part of dart.core; |
6 | 6 |
7 /** | 7 /** |
8 * The signature of a generic comparison function. | 8 * The signature of a generic comparison function. |
9 * | 9 * |
10 * A comparison function represents an ordering on a type of objects. | 10 * A comparison function represents an ordering on a type of objects. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 * Returns a value like a [Comparator] when comparing [:this:] to [other]. | 56 * Returns a value like a [Comparator] when comparing [:this:] to [other]. |
57 * | 57 * |
58 * May throw an [ArgumentError] if [other] is of a type that | 58 * May throw an [ArgumentError] if [other] is of a type that |
59 * is not comparable to [:this:]. | 59 * is not comparable to [:this:]. |
60 */ | 60 */ |
61 int compareTo(T other); | 61 int compareTo(T other); |
62 | 62 |
63 /** | 63 /** |
64 * A [Comparator] that compares one comparable to another. | 64 * A [Comparator] that compares one comparable to another. |
65 * | 65 * |
| 66 * It returns the result of `a.compareTo(b)`. |
| 67 * |
66 * This utility function is used as the default comparator | 68 * This utility function is used as the default comparator |
67 * for ordering collections, for example in the [List] sort function. | 69 * for ordering collections, for example in the [List] sort function. |
68 */ | 70 */ |
69 static int compare(Comparable a, Comparable b) => a.compareTo(b); | 71 static int compare(Comparable a, Comparable b) => a.compareTo(b); |
70 } | 72 } |
OLD | NEW |