this is what I have so far, but I'm having trouble with one line:
public class SFHashMap<Key, Value> {
private static int size;
private Entry<Key, Value>[] table;
class Entry<Key, Value> {
Key key;
Value value;
Entry next;
public Entry(Key key, Value value, Entry<Key, Value> next) {
this.key = key;
this.value = value;
this.next = next;
}
}
public SFHashMap() {
this(16);
}
public SFHashMap(int size) {
this.size = size;
table = new Entry[size]; **HERE**
}
}
for table = new Entry[size];
, I can't instantiate it as new Entry<Key, Value>[size]
because I can't create generic arrays. What is the best way to go about this? Thanks