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 final _HashMapTable<K, V> _hashTable = new _HashMapTable<K, V>(); | 6 final _HashMapTable<K, V> _hashTable = new _HashMapTable<K, V>(); |
7 | 7 |
8 /* patch */ HashMap() { | 8 /* patch */ HashMap() { |
9 _hashTable._container = this; | 9 _hashTable._container = this; |
10 } | 10 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 _table._checkCapacity(); | 148 _table._checkCapacity(); |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 /* patch */ bool remove(Object object) { | 152 /* patch */ bool remove(Object object) { |
153 int offset = _table._remove(object); | 153 int offset = _table._remove(object); |
154 _table._checkCapacity(); | 154 _table._checkCapacity(); |
155 return offset >= 0; | 155 return offset >= 0; |
156 } | 156 } |
157 | 157 |
158 /* patch */ void removeAll(Iterable objectsToRemove) { | 158 /* patch */ void removeAll(Iterable<Object> objectsToRemove) { |
159 for (Object object in objectsToRemove) { | 159 for (Object object in objectsToRemove) { |
160 _table._remove(object); | 160 _table._remove(object); |
161 _table._checkCapacity(); | 161 _table._checkCapacity(); |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 void _filterWhere(bool test(E element), bool removeMatching) { | 165 void _filterWhere(bool test(E element), bool removeMatching) { |
166 int entrySize = _table._entrySize; | 166 int entrySize = _table._entrySize; |
167 int length = _table._table.length; | 167 int length = _table._table.length; |
168 for (int offset = 0; offset < length; offset += entrySize) { | 168 for (int offset = 0; offset < length; offset += entrySize) { |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 | 1001 |
1002 _LinkedHashMapTable() : super(_INITIAL_CAPACITY); | 1002 _LinkedHashMapTable() : super(_INITIAL_CAPACITY); |
1003 | 1003 |
1004 V _value(int offset) => _table[offset + _VALUE_INDEX]; | 1004 V _value(int offset) => _table[offset + _VALUE_INDEX]; |
1005 void _setValue(int offset, V value) { _table[offset + _VALUE_INDEX] = value; } | 1005 void _setValue(int offset, V value) { _table[offset + _VALUE_INDEX] = value; } |
1006 | 1006 |
1007 _copyEntry(List oldTable, int fromOffset, int toOffset) { | 1007 _copyEntry(List oldTable, int fromOffset, int toOffset) { |
1008 _table[toOffset + _VALUE_INDEX] = oldTable[fromOffset + _VALUE_INDEX]; | 1008 _table[toOffset + _VALUE_INDEX] = oldTable[fromOffset + _VALUE_INDEX]; |
1009 } | 1009 } |
1010 } | 1010 } |
OLD | NEW |