Skip to content

12.2 typos #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions data/part-12/2-arraylist-and-hashtable.md
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,9 @@ public V get(K key) {

List<Pair<K, V>> valuesAtIndex = this.values[hashValue];

for (int i = 0; i < valuesAtINdex.size(); i++) {
for (int i = 0; i < valuesAtIndex.size(); i++) {
if (valuesAtIndex.value(i).getKey().equals(key)) {
return valuesAtindex.value(i).getValue();
return valuesAtIndex.value(i).getValue();
}
}

Expand Down Expand Up @@ -843,11 +843,11 @@ public void add(K key, V value) {
values[hashValue] = new List<>();
}

List<Pari<K, V>> valuesAtindex = values[hashValue];
List<Pari<K, V>> valuesAtIndex = values[hashValue];

int index = -1;
for (int i = 0; i < valuesAtIndex.size(); i++) {
if (valuesAtINdex.value(i).getKey().equals(key)) {
if (valuesAtIndex.value(i).getKey().equals(key)) {
index = i;
break;
}
Expand Down Expand Up @@ -937,7 +937,7 @@ public void add(K key, V value) {
valuesAtIndex.add(new Pair<>(key, value));
this.firstFreeIndex++;
} else {
valuesAtindex.value(index).setValue(value);
valuesAtIndex.value(index).setValue(value);
}
}
```
Expand Down Expand Up @@ -1114,7 +1114,7 @@ Let's give the hash map the functionality to remove a key-value pair based on ke

<!-- Voimme hyödyntää valmiiksi toteuttamiamme metodeja poistotoiminnallisuudessa. Selitä itsellesi (ääneen) alla olevan metodin konkreettinen toiminta. -->

We can take advantage of the method we've already implemented in the removing method. Explain to yourself (out loud) how the method described below conretely works.
We can take advantage of the method we've already implemented in the removing method. Explain to yourself (out loud) how the method described below concretely works.

<!-- ```java
public V remove(K avain) {
Expand Down Expand Up @@ -1246,7 +1246,7 @@ System.out.println("Hash map: the search took about " + hashMapSearch / 1000000
<sample-output>

List: the search took about 6284 milliseconds (6284420580 nanoseconds.)
Hajautustaulu: the search took about 0 milliseconds (805106 nanoseconds.)
Hash map: the search took about 0 milliseconds (805106 nanoseconds.)

</sample-output>

Expand Down