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 081c371 commit 5711790Copy full SHA for 5711790
Exercise_27/Exercise_27_04/MyHashMap.class
-13 Bytes
Exercise_27/Exercise_27_04/MyHashMap.java
@@ -105,12 +105,12 @@ public V get(K key) {
105
public java.util.Set<V> getAll(K key) {
106
java.util.Set<V> set = new java.util.HashSet<>();
107
int index = hash(key.hashCode());
108
- int i = index - 1;
109
110
- while (i != index) {
111
- if (table.get(index) != null && table.get(index).getKey() == key) {
+ while (table.get(index) != null ) {
+ if (table.get(index).getKey().equals(key)) {
112
set.add(table.get(index).getValue());
113
}
+
114
index++;
115
index %= capacity;
116
0 commit comments