We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6fde7c4 commit 3a48e3fCopy full SHA for 3a48e3f
Exercise_27/Exercise_27_01/MyHashMap.class
3 Bytes
Exercise_27/Exercise_27_01/MyHashMap.java
@@ -90,7 +90,7 @@ public V get(K key) {
90
int index = hash(key.hashCode());
91
92
while(table.get(index) != null) {
93
- if (table.get(index).getKey() == key) {
+ if (table.get(index).getKey().equals(key)) {
94
return table.get(index).getValue();
95
}
96
index++;
@@ -120,7 +120,7 @@ public java.util.Set<K> keySet() {
120
@Override /** Add an entry (key, value) into the map */
121
public V put(K key, V value) {
122
123
-
+
124
while (table.get(index) != null) {
125
// The key is already in the map
126
if (table.get(index).getKey().equals(key)) {
0 commit comments