In the above instance, A is the type the sortList function will work on. In other words, it will take a list containing objects of type A and sort them, returning a new List with objects of type A.
You would use it as follows:
val list = 10::30::List(20)
val sortedList = sortList(list)
scala , Int , "A" - .
, scala , , - Int
, , List List [Int], , sortList, , sortList, - List [Int]
, , . scala scala Eclipse, , . , , sortList , Ints, .
val list = 10::30::List(20)
val stringList = "1"::"2"::List("3")
def sortList[A](xs: List[A]): List[A] = xs
sortList(list)
sortList(stringList)
def sortListInt = sortList[Int] _
sortListInt(list)
sortListInt(stringList)