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:typed_data'; | |
6 import 'dart:_internal' as internal; | |
7 | |
8 @patch class HashMap<K, V> { | 5 @patch class HashMap<K, V> { |
9 @patch factory HashMap({ bool equals(K key1, K key2), | 6 @patch factory HashMap({ bool equals(K key1, K key2), |
10 int hashCode(K key), | 7 int hashCode(K key), |
11 bool isValidKey(potentialKey) }) { | 8 bool isValidKey(potentialKey) }) { |
12 if (isValidKey == null) { | 9 if (isValidKey == null) { |
13 if (hashCode == null) { | 10 if (hashCode == null) { |
14 if (equals == null) { | 11 if (equals == null) { |
15 return new _HashMap<K, V>(); | 12 return new _HashMap<K, V>(); |
16 } | 13 } |
17 hashCode = _defaultHashCode; | 14 hashCode = _defaultHashCode; |
18 } else { | 15 } else { |
19 if (identical(identityHashCode, hashCode) && | 16 if (identical(identityHashCode, hashCode) && |
20 identical(identical, equals)) { | 17 identical(identical, equals)) { |
21 return new _IdentityHashMap<K, V>(); | 18 return new _IdentityHashMap<K, V>(); |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 if (equals == null) { | 969 if (equals == null) { |
973 equals = _defaultEquals; | 970 equals = _defaultEquals; |
974 } | 971 } |
975 } | 972 } |
976 return new _CompactLinkedCustomHashSet<E>(equals, hashCode, isValidKey); | 973 return new _CompactLinkedCustomHashSet<E>(equals, hashCode, isValidKey); |
977 } | 974 } |
978 | 975 |
979 @patch factory LinkedHashSet.identity() = | 976 @patch factory LinkedHashSet.identity() = |
980 _CompactLinkedIdentityHashSet<E>; | 977 _CompactLinkedIdentityHashSet<E>; |
981 } | 978 } |
OLD | NEW |