You can just use a HashMap to store the Objects
public static HashMap<Class, Object> instances = new HashMap<Class, Object>();
public Object getInstance(Class clazz) {
if (instances.constainsKey(clazz)) {
return instances.get(clazz);
} else {
Object o = clazz.newInstance();
instances.put(clazz, o);
return o
}
}
But I don't actually understand the purpose and there seems like there's a better way to solve your problem.