My question is very similar to this question. I want to be able to instantiate an object of the type parameter type, but also without needing to pass in a "factory". I really need to be contained all in the one class.
public class myClass<E> {
E someObject;
public myClass(){
someObject = new E();
}
}
Previous solutions required the constructor of myClass to be changed to have a factory parameter, and then to call the constructor of that, but for my purposes I don't want to modify any calls to myClass from the outside.
Any help? If I didn't explain well, I can add more. Thanks.