|
|
|
|
18
|
Details instructions on what each method should do and return is in `MyMap` class.
|
18
|
Details instructions on what each method should do and return is in `MyMap` class.
|
19
|
|
19
|
|
20
|
### Part 2 - ListMap
|
20
|
### Part 2 - ListMap
|
21
|
-A list map stores every entry in a list. Every time the user calls `put`, create a new `Entry` and add it to the list. Your task is to make all the test pass.
|
|
|
|
|
21
|
+A list map stores every entry in a list. Every time the user calls `put`, create a new `Entry` and add it to the list. Your task is to make all the tests in `test/java/org/zipcoder/store/ListMapTest.java` pass.
|
22
|
1. Uncomment line 178 - 196. Notice how long the test takes to run.
|
22
|
1. Uncomment line 178 - 196. Notice how long the test takes to run.
|
23
|
|
23
|
|
24
|
**BONUS**: Uncomment the remove method and add the code to pass the tests.
|
24
|
**BONUS**: Uncomment the remove method and add the code to pass the tests.
|
25
|
|
25
|
|
26
|
### Part 3 - MyHashMap
|
26
|
### Part 3 - MyHashMap
|
27
|
-If you still have no idea what a HashMap is, watch this [video](https://www.youtube.com/watch?v=shs0KM3wKv8). Notice I add the `bucketIndex` to help you determine where to store the entry. The `bucketIndex` uses the `hashCode` to try to evenly distribute the entries.
|
|
|
|
|
27
|
+If you still have no idea what a HashMap is, read this [article](https://medium.com/@nhu313/what-is-a-java-hashmap-83152fb632bb) or watch this [video](https://www.youtube.com/watch?v=shs0KM3wKv8). Notice I add the `bucketIndex` to help you determine where to store the entry. The `bucketIndex` uses the `hashCode` to try to evenly distribute the entries.
|
28
|
1. `put` - find which bucket it belongs to, then add it to the list of that bucket
|
28
|
1. `put` - find which bucket it belongs to, then add it to the list of that bucket
|
29
|
2. `get` - find which bucket it belongs to, then loop through the list to find the entry corresponding to the key
|
29
|
2. `get` - find which bucket it belongs to, then loop through the list to find the entry corresponding to the key
|
30
|
3. Uncomment line 178 - 196. Notice how fast it takes to run.
|
30
|
3. Uncomment line 178 - 196. Notice how fast it takes to run.
|