Type parameters applied to Scala Function

后端 未结 6 1016
遇见更好的自我
遇见更好的自我 2021-01-23 08:35

I am trying to understand the type parameters when applied to a function.

I would like to use Generic Types in the below method but using String and Int for my understa

6条回答
  •  终归单人心
    2021-01-23 09:06

    Your generic type name shouldn't be one of the reserved words in Scala. Int itself is a reserved word for a type. In this cases, for simplicity and understanding, we use some basic characters like T or R as the generic type if you really keen to use generics for other functions.

提交回复
热议问题