用于在方法调用中显式指定泛型参数的Java语法 [英] Java-syntax for explicitly specifying generic arguments in method calls
本文介绍了用于在方法调用中显式指定泛型参数的Java语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
明确给出泛型Java方法的类型参数的语法是什么? 下面是
< ArgType> genericMethod()
看起来类型参数必须在
<$ < ArgType> genericMethod()
super < ArgType> genericMethod()
SomeClass.super。< ArgType> genericMethod()
SomeClass.this。< ArgType> genericMethod()
What is the syntax for explicitly giving the type parameters for a generic Java method?
解决方案
The following is not the syntax
<ArgType>genericMethod()
It seems the type arguments must come after a dot as in
SomeClass.<ArgType>genericMethod()
this.<ArgType>genericMethod()
p.<ArgType>genericMethod()
super.<ArgType>genericMethod()
SomeClass.super.<ArgType>genericMethod()
SomeClass.this.<ArgType>genericMethod()
这篇关于用于在方法调用中显式指定泛型参数的Java语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文