Finds and removes entry from the bucket linked lists in both the key-to-value direction and the value-to-key direction.
(BiEntry<K, V> entry)
| 131 | * key-to-value direction and the value-to-key direction. |
| 132 | */ |
| 133 | private void delete(BiEntry<K, V> entry) { |
| 134 | int keyBucket = entry.keyHash & mask; |
| 135 | BiEntry<K, V> prevBucketEntry = null; |
| 136 | for (BiEntry<K, V> bucketEntry = hashTableKToV[keyBucket]; |
| 137 | true; |
| 138 | bucketEntry = bucketEntry.nextInKToVBucket) { |
| 139 | if (bucketEntry == entry) { |
| 140 | if (prevBucketEntry == null) { |
| 141 | hashTableKToV[keyBucket] = entry.nextInKToVBucket; |
| 142 | } else { |
| 143 | prevBucketEntry.nextInKToVBucket = entry.nextInKToVBucket; |
| 144 | } |
| 145 | break; |
| 146 | } |
| 147 | prevBucketEntry = bucketEntry; |
| 148 | } |
| 149 | |
| 150 | int valueBucket = entry.valueHash & mask; |
| 151 | prevBucketEntry = null; |
| 152 | for (BiEntry<K, V> bucketEntry = hashTableVToK[valueBucket]; |
| 153 | true; |
| 154 | bucketEntry = bucketEntry.nextInVToKBucket) { |
| 155 | if (bucketEntry == entry) { |
| 156 | if (prevBucketEntry == null) { |
| 157 | hashTableVToK[valueBucket] = entry.nextInVToKBucket; |
| 158 | } else { |
| 159 | prevBucketEntry.nextInVToKBucket = entry.nextInVToKBucket; |
| 160 | } |
| 161 | break; |
| 162 | } |
| 163 | prevBucketEntry = bucketEntry; |
| 164 | } |
| 165 | |
| 166 | if (entry.prevInKeyInsertionOrder == null) { |
| 167 | firstInKeyInsertionOrder = entry.nextInKeyInsertionOrder; |
| 168 | } else { |
| 169 | entry.prevInKeyInsertionOrder.nextInKeyInsertionOrder = entry.nextInKeyInsertionOrder; |
| 170 | } |
| 171 | |
| 172 | if (entry.nextInKeyInsertionOrder == null) { |
| 173 | lastInKeyInsertionOrder = entry.prevInKeyInsertionOrder; |
| 174 | } else { |
| 175 | entry.nextInKeyInsertionOrder.prevInKeyInsertionOrder = entry.prevInKeyInsertionOrder; |
| 176 | } |
| 177 | |
| 178 | size--; |
| 179 | modCount++; |
| 180 | } |
| 181 | |
| 182 | private void insert(BiEntry<K, V> entry, @Nullable BiEntry<K, V> oldEntryForKey) { |
| 183 | int keyBucket = entry.keyHash & mask; |