Im creating an inner class in Java that uses outer class' parameterized types as instance fields. Now when I try to create an arrayof this innerclass, I get classcast exception
class ModdedSeperateChainingAlternate<Key, Value> extends SeperateChainingHashST<Key, Value> {
int N;
int M;
Node[] list = (Node[]) new Object[M]; // classcast exception
class Node {
Node next;
Key key;
Value value;
int n;
public Node(Key k, Value v, Node next) {
this.key = k;
this.value = v;
this.next = next;
}
......
}
Please advice me on how to get around this. Im a generics noob