|
To help you get started, I have provided you with 2 partially written Java classes that implements the above interfaces:
|
So in each of the provided file, there are a few methods missing. You must write those methods according to the specifications given in comment near the method definition.
|
You can choose to do it in any one of the methods... it's up to you. You can even make changes to the put() and remove() method.
It does many insert, get and remove operations and print the map after each operation:
import java.util.*; public class MyTestMap { public static void main(String[] args) { int i; Integer x; String s; Map |
cheung@compute(1137)> java MyTestMap +(a,1): {(a,1) } (1 entries) +(b,5): {[(b,5) (a,1) ] } (2 entries) +(c,6): {(c,6) [(b,5) (a,1) ] } (3 entries) +(d,8): {[(d,8) (c,6) ] [(b,5) (a,1) ] } (4 entries) *(d,3): {[(d,3) (c,6) ] [(b,5) (a,1) ] } (4 entries) +(e,4): {[(e,4) (d,3) (c,6) ] [(b,5) (a,1) ] } (5 entries) *(e,7): {[(e,7) (d,3) (c,6) ] [(b,5) (a,1) ] } (5 entries) +(f,9): {[(e,7) (d,3) (c,6) ] [(b,5) (a,1) ] (f,9) } (6 entries) +(g,2): {[(e,7) (d,3) (c,6) ] [(b,5) (a,1) ] [(g,2) (f,9) ] } (7 entries) Value of d = 3 Value of e = 7 Value of x = null -a: {[(e,7) (d,3) (c,6) ] (b,5) [(g,2) (f,9) ] } (6 entries) -a: {[(e,7) (d,3) (c,6) ] (b,5) [(g,2) (f,9) ] } (6 entries) -b: {[(e,7) (d,3) (c,6) ] [(g,2) (f,9) ] } (5 entries) -b: {[(e,7) (d,3) (c,6) ] [(g,2) (f,9) ] } (5 entries) -c: {[(e,7) (d,3) ] [(g,2) (f,9) ] } (4 entries) -d: {(e,7) [(g,2) (f,9) ] } (3 entries) -g: {(e,7) (f,9) } (2 entries) |
|
/home/cs323000/turnin HashListMap.java pj1 /home/cs323000/turnin HashListEntry.java pj1a |
|