Currently, I'm working with Scala language and I don't know how to determine the type of generic type. I have a class as following code.
class A[K, V]() {
def print(): Unit = {
//Check the real type here
}
}
What I want to do is:
- If K is Int => Print out
It is an Integer - If K is Long => Print out
It is a Long - If K is String => Print out
It is a String