| 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 patch class HashMap<K, V> { | 5 patch class HashMap<K, V> { |
| 6 static const int _INITIAL_CAPACITY = 8; | 6 static const int _INITIAL_CAPACITY = 8; |
| 7 static const int _MODIFICATION_COUNT_MASK = 0x3fffffff; | 7 static const int _MODIFICATION_COUNT_MASK = 0x3fffffff; |
| 8 | 8 |
| 9 int _elementCount = 0; | 9 int _elementCount = 0; |
| 10 List<_HashMapEntry> _buckets = new List(_INITIAL_CAPACITY); | 10 List<_HashMapEntry> _buckets = new List(_INITIAL_CAPACITY); |
| 11 int _modificationCount = 0; | 11 int _modificationCount = 0; |
| 12 | 12 |
| 13 /* patch */ HashMap(); | 13 /* patch */ HashMap._internal(); |
| 14 | 14 |
| 15 /* patch */ int get length => _elementCount; | 15 /* patch */ int get length => _elementCount; |
| 16 /* patch */ bool get isEmpty => _elementCount == 0; | 16 /* patch */ bool get isEmpty => _elementCount == 0; |
| 17 /* patch */ bool get isNotEmpty => _elementCount != 0; | 17 /* patch */ bool get isNotEmpty => _elementCount != 0; |
| 18 | 18 |
| 19 /* patch */ Iterable<K> get keys => new _HashMapKeyIterable<K>(this); | 19 /* patch */ Iterable<K> get keys => new _HashMapKeyIterable<K>(this); |
| 20 /* patch */ Iterable<V> get values => new _HashMapValueIterable<V>(this); | 20 /* patch */ Iterable<V> get values => new _HashMapValueIterable<V>(this); |
| 21 | 21 |
| 22 /* patch */ bool containsKey(Object key) { | 22 /* patch */ bool containsKey(Object key) { |
| 23 int hashCode = key.hashCode; | 23 int hashCode = key.hashCode; |
| (...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 | 1307 |
| 1308 _LinkedHashMapTable() : super(_INITIAL_CAPACITY); | 1308 _LinkedHashMapTable() : super(_INITIAL_CAPACITY); |
| 1309 | 1309 |
| 1310 V _value(int offset) => _table[offset + _VALUE_INDEX]; | 1310 V _value(int offset) => _table[offset + _VALUE_INDEX]; |
| 1311 void _setValue(int offset, V value) { _table[offset + _VALUE_INDEX] = value; } | 1311 void _setValue(int offset, V value) { _table[offset + _VALUE_INDEX] = value; } |
| 1312 | 1312 |
| 1313 _copyEntry(List oldTable, int fromOffset, int toOffset) { | 1313 _copyEntry(List oldTable, int fromOffset, int toOffset) { |
| 1314 _table[toOffset + _VALUE_INDEX] = oldTable[fromOffset + _VALUE_INDEX]; | 1314 _table[toOffset + _VALUE_INDEX] = oldTable[fromOffset + _VALUE_INDEX]; |
| 1315 } | 1315 } |
| 1316 } | 1316 } |
| OLD | NEW |