Package Com.leegh.parameterization
/**
* @author Guohui Li
*/
Import Scala.reflect.ClassTag
Class Trible[f, S, T] (Val first:f, Val second:s, Val third:t)
Object Hello_type_parameterization {
def main (args:array[string]): Unit = {
val triple = new Triple ("Spark", 3, 3.1415)
Val bigdata = new triple[string, String, Char] ("Spark", "Hadoop", ' R ')
def Getdata[t] (list:list[t]) = List (LIST.LENGTH/2)
println (GetData (List ("Spark", "Hadoop", ' R '))
Val F = getdata[int]_
println (f (List (1,2,3,4,5,6,7,8)))
def Buildarray[t:classtag] (len:int) = new Array[t] (len)
println (Buildarray[int] (5). ToList)
}
}
Report:
This blog description:
1. Organize your ideas and improve yourself.
2. Be educated in Liaoliang teacher, what to gain, so recommend.
3. Blog focus on practice, superfluous words are not much to say, are doing technology.
4. Information from DT Big Data Dream Factory public account: Dt_spark.?
DT Big Data Dream Factory's public number is Dt_spark, every day will have big data actual combat video release, please continue to study.
Liaoliang DT Big Data dream factory Scala all videos, PPT and code in Baidu Cloud disk link:http://pan.baidu.com/share/home?uk=4013289088#category/type=0& Qq-pf-to=pcqq.group
Liaoliang "Scala Beginner's introductory classic video course" http://edu.51cto.com/lesson/id-66538.html
Liaoliang "Scala Advanced Classic Video Course" http://edu.51cto.com/lesson/id-67139.html
Scala's extensive application of generic classes, generic functions, generics in Spark, Scala learning notes-33