Is it possible to reference a nested generic parameter in java?

前端 未结 5 845
孤街浪徒
孤街浪徒 2020-12-11 01:52

I\'m not sure what the technical term for this is, but consider an interface:

public interface SomeInterface {
     public T doSomething();
}
         


        
5条回答
  •  自闭症患者
    2020-12-11 02:16

    As the type parameters are erased at compile time, IMHO you unfortunately cannot achieve what you want without specifying T as the second type parameter, just as you did in your first example.

提交回复
热议问题