Blog
This is merely a demo, find out more about Garth
This is merely a demo, find out more about Garth
泛型让我们在定义类(或接口)和方法时,可以对类型进行参数化。参数化类型使得我们能够重用同一段代码来处理不同的具体类型。
考虑一个泛型类 GenericType
,它用来存储某种“类型”的值:
class GenericType<T>(val t: T) { fun get(): T { return t } }
这样,我们就可以用具体的类型创建这个类的对象,例如:
val stringInstance: GenericType<String>...
-
Who is Dana Carvey?
People
·
Dana Thomas Carvey (born June 2, 1955) is a performer and stand-up comedian known for their work as a cast member on Saturday Night Live and for playing the role of Garth Algar in the Wayne’s World films.