What is major difference between those two?
For example when creating custom class, which handles what thread should do I am left with 2 options:
class ThreadHandler : Runnable {
private val thread = Thread(this)
override fun run() {}
}
AND
class ThreadHandler : () -> Unit {
private val thread = Thread(this)
override fun invoke() {}
}
I am asking for:
- Advantages and disadvantages of each other (because I believe that Runnable is implemented and "() -> Unit" is extended)
- Which is preferred way of using in this scenario