OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import "dart:collection"; | 5 import "dart:collection"; |
6 | 6 |
| 7 import "comparators.dart"; |
| 8 |
7 const int _HASH_MASK = 0x7fffffff; | 9 const int _HASH_MASK = 0x7fffffff; |
8 | 10 |
9 /// A generic equality relation on objects. | 11 /// A generic equality relation on objects. |
10 abstract class Equality<E> { | 12 abstract class Equality<E> { |
11 const factory Equality() = DefaultEquality<E>; | 13 const factory Equality() = DefaultEquality<E>; |
12 | 14 |
13 /// Compare two elements for being equal. | 15 /// Compare two elements for being equal. |
14 /// | 16 /// |
15 /// This should be a proper equality relation. | 17 /// This should be a proper equality relation. |
16 bool equals(E e1, E e2); | 18 bool equals(E e1, E e2); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 class CaseInsensitiveEquality implements Equality<String> { | 391 class CaseInsensitiveEquality implements Equality<String> { |
390 const CaseInsensitiveEquality(); | 392 const CaseInsensitiveEquality(); |
391 | 393 |
392 bool equals(String string1, String string2) => | 394 bool equals(String string1, String string2) => |
393 equalsIgnoreAsciiCase(string1, string2); | 395 equalsIgnoreAsciiCase(string1, string2); |
394 | 396 |
395 int hash(String string) => hashIgnoreAsciiCase(string); | 397 int hash(String string) => hashIgnoreAsciiCase(string); |
396 | 398 |
397 bool isValidKey(Object object) => object is String; | 399 bool isValidKey(Object object) => object is String; |
398 } | 400 } |
OLD | NEW |