Reputation: 3013
In Scala
I can use underscore as a type variable in function, for instance.
def fun[_, _]() = {
// ?
}
fun[Int, String]()
Is it so useful in real life programming? How could it be useful for me?
Upvotes: 3
Views: 640
Reputation: 170713
Is it so useful in real life programming?
No, it isn't.
How could it be useful for me?
To confuse people. You could theoretically use it to mark an unused type parameter when e.g. overriding a method, but I don't think I've ever seen this.
Upvotes: 1