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 import "comparators.dart"; | |
nweiz
2016/11/11 23:16:46
Nit: newline above.
Lasse Reichstein Nielsen
2016/11/14 14:52:04
Done.
| |
6 | 7 |
7 const int _HASH_MASK = 0x7fffffff; | 8 const int _HASH_MASK = 0x7fffffff; |
8 | 9 |
9 /// A generic equality relation on objects. | 10 /// A generic equality relation on objects. |
10 abstract class Equality<E> { | 11 abstract class Equality<E> { |
11 const factory Equality() = DefaultEquality<E>; | 12 const factory Equality() = DefaultEquality<E>; |
12 | 13 |
13 /// Compare two elements for being equal. | 14 /// Compare two elements for being equal. |
14 /// | 15 /// |
15 /// This should be a proper equality relation. | 16 /// This should be a proper equality relation. |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 class CaseInsensitiveEquality implements Equality<String> { | 390 class CaseInsensitiveEquality implements Equality<String> { |
390 const CaseInsensitiveEquality(); | 391 const CaseInsensitiveEquality(); |
391 | 392 |
392 bool equals(String string1, String string2) => | 393 bool equals(String string1, String string2) => |
393 equalsIgnoreAsciiCase(string1, string2); | 394 equalsIgnoreAsciiCase(string1, string2); |
394 | 395 |
395 int hash(String string) => hashIgnoreAsciiCase(string); | 396 int hash(String string) => hashIgnoreAsciiCase(string); |
396 | 397 |
397 bool isValidKey(Object object) => object is String; | 398 bool isValidKey(Object object) => object is String; |
398 } | 399 } |
OLD | NEW |