0

有没有办法知道收藏信息?

fun foo(clazz: Class<*>) {
  // 1. How to know clazz is collection?
  // 2. How to know T of Collection<T> is String?
}

fun myFunc() {
  val mySet: HashSet<String> = HashSet()
  foo(mySet::class.java)
}
4

0 回答 0