fun<T> singletonList(item:T):List<T>{
    .....
}
fun<T>T.basicToString():String{
    ....
}

调用泛型的函数,应该在函数名称之后指定调用端类型参数:

val i =singletonList(Int)(1)

 

相关文章:

  • 2020-12-29
  • 2021-09-27
  • 2021-09-23
  • 2022-03-07
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
猜你喜欢
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
相关资源
相似解决方案