You can't create an array of generic type. The following code is invalid:
List<String>[] listArray = new List<String>[10]; // Error
It would be better to use an Object[]
internally to store the elements, and let the method returning the elements do appropriate cast:
public class HashTable<T> {
private Object[] table;
private static final int SIZE = 50;
public HashTable(){
this.table = new Object[SIZE];
for(int i = 0; i < SIZE; i++)
this.table[i] = new GenericLinkedList();
}
}
FYI, this is how the java.util.ArrayList
is implemented.
P.S.: Why your Hashtable
doesn't seem to have key-value mapping kind of thing? This is more like a list.