File tree 2 files changed +3
-4
lines changed
main/java/com/thealgorithms/datastructures/hashmap/hashing
test/java/com/thealgorithms/datastructures/hashmap/hashing
2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -166,8 +166,7 @@ public void delete(K key) {
166
166
// Traverse the list to find and delete the node
167
167
Node <K , V > current = head ;
168
168
while (current .getNext () != null ) {
169
- if ((key == null && current .getNext ().getKey () == null ) ||
170
- (current .getNext ().getKey () != null && current .getNext ().getKey ().equals (key ))) {
169
+ if ((key == null && current .getNext ().getKey () == null ) || (current .getNext ().getKey () != null && current .getNext ().getKey ().equals (key ))) {
171
170
current .setNext (current .getNext ().getNext ());
172
171
return ;
173
172
}
@@ -252,7 +251,7 @@ public V getValue() {
252
251
return value ;
253
252
}
254
253
255
- public void setValue (V value ) { // This method allows updating the value
254
+ public void setValue (V value ) { // This method allows updating the value
256
255
this .value = value ;
257
256
}
258
257
Original file line number Diff line number Diff line change @@ -150,4 +150,4 @@ public void testDeleteMiddleElementOfBucket() {
150
150
assertEquals ("Value1" , hashMap .search (1 ));
151
151
assertEquals ("Value7" , hashMap .search (7 ));
152
152
}
153
- }
153
+ }
You can’t perform that action at this time.
0 commit comments