OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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' show Uint32List; | 5 import 'dart:typed_data' show Uint32List; |
| 6 import 'dart:_internal' as internal; |
6 | 7 |
7 // Hash table with open addressing that separates the index from keys/values. | 8 // Hash table with open addressing that separates the index from keys/values. |
8 | 9 |
9 abstract class _HashFieldBase { | 10 abstract class _HashFieldBase { |
10 // Each occupied entry in _index is a fixed-size integer that encodes a pair: | 11 // Each occupied entry in _index is a fixed-size integer that encodes a pair: |
11 // [ hash pattern for key | index of entry in _data ] | 12 // [ hash pattern for key | index of entry in _data ] |
12 // The hash pattern is based on hashCode, but is guaranteed to be non-zero. | 13 // The hash pattern is based on hashCode, but is guaranteed to be non-zero. |
13 // The length of _index is always a power of two, and there is always at | 14 // The length of _index is always a power of two, and there is always at |
14 // least one unoccupied entry. | 15 // least one unoccupied entry. |
15 // NOTE: When maps are deserialized, their _index and _hashMask is regenerated | 16 // NOTE: When maps are deserialized, their _index and _hashMask is regenerated |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 E lookup(Object o) => _validKey(o) ? super.lookup(o) : null; | 592 E lookup(Object o) => _validKey(o) ? super.lookup(o) : null; |
592 bool remove(Object o) => _validKey(o) ? super.remove(o) : false; | 593 bool remove(Object o) => _validKey(o) ? super.remove(o) : false; |
593 | 594 |
594 _CompactLinkedCustomHashSet(this._equality, this._hasher, validKey) | 595 _CompactLinkedCustomHashSet(this._equality, this._hasher, validKey) |
595 : _validKey = (validKey != null) ? validKey : new _TypeTest<E>().test; | 596 : _validKey = (validKey != null) ? validKey : new _TypeTest<E>().test; |
596 | 597 |
597 Set<E> toSet() => | 598 Set<E> toSet() => |
598 new _CompactLinkedCustomHashSet<E>(_equality, _hasher, _validKey) | 599 new _CompactLinkedCustomHashSet<E>(_equality, _hasher, _validKey) |
599 ..addAll(this); | 600 ..addAll(this); |
600 } | 601 } |
OLD | NEW |