Is it possible to create an instance of a generic type in Java? I\'m thinking based on what I\'ve seen that the answer is no (due to type erasure), but
no
Use the TypeToken class:
public class MyClass { public T doSomething() { return (T) new TypeToken(){}.getRawType().newInstance(); } }