I want to create a Cache object. Naturally, I want this cache object to be typed. The problem is how do I create the empty array to insert the objects into (because I have no type reference).
public class Cache<T> {
int size;
T[] items;
public Cache(int size){
this.setSize(size);
}
public void setSize(int size){
this.size = size;
this.items = new T[size]; //this doesnt work!
}
}