0

Is there a way to know information of collection?

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)
}
Kyoung-june Yi
  • 503
  • 1
  • 3
  • 16

0 Answers0