I have the following structure:
public class SomeObject<T> {
int key;
T value;
...
}
And in another class:
public class TestSomeObject<T> {
SomeObject<T>[] data;
TestSomeObject() {
this.data = (SomeObject<T>[]) new Object[capacity];
}
}
Of course, that line in the constructor utterly fails with the Exception:
[Ljava.lang.Object; cannot be cast to [SomeObject;
Are there any workarounds for this? Or is there any way I could restructure it to make it work?