I am trying to create an array of a specific Data Type, however I am getting a Type Safety error I cannot understand/solve.
The data type
private static class Component<F> {
private int index;
private F value;
public Component(int index, F value) {
this.index = index;
this.value = value;
}
And the code where I try to initialize the array
private Component<F>[] table;
// Constructor
public SparseVector(int n, F f) {
table = new Component[n];
}
However I get the said type safety error, and upon running the program inspecting the variables in debugging I get the message "Type has not been loaded occurred while retrieving component type of array."