3
/** Initialize your data structure here. */4
LinkedList<Entry>[] map;6
public static int SIZE = 769;9
map = new LinkedList[SIZE];12
/** value will always be non-negative. */13
public void put(int key, int value) {14
int bucket = key % SIZE;15
if (map[bucket] == null) {16
map[bucket] = new LinkedList<Entry>();17
map[bucket].add(new Entry(key, value));19
for (Entry entry : map[bucket]) {20
if (entry.key == key) {25
map[bucket].add(new Entry(key, value));30
* Returns the value to which the specified key is mapped, or -1 if this map contains no mapping33
public int get(int key) {34
int bucket = key % SIZE;35
LinkedList<Entry> entries = map[bucket];36
if (entries == null) return -1;37
for (Entry entry : entries) {38
if (entry.key == key) return entry.val;43
/** Removes the mapping of the specified value key if this map contains a mapping for the key */44
public void remove(int key) {45
int bucket = key % SIZE;46
Entry toRemove = null;47
if (map[bucket] == null) return;49
for (Entry entry : map[bucket]) {50
if (entry.key == key) {54
if (toRemove == null) return;55
map[bucket].remove(toRemove);64
public Entry(int key, int val) {