bmo
07/11/2017, 7:20 AMempty
(or something else) that could be added to an abstract class or an interface. The idea would be that adding the keyword would implement every method with an empty implementation. That would be particularly helpful when you want to implement only one method of an interface that has a lot of methods. E.g. :
class MyClass : MyInterface by empty MyInterface() {
override fun onlyOneMethod() {
//...
}
}
Of course, it would return null
for nullable object, 0 for numeric value, false for boolean and "" for String.
For non-nullable objects return, an implementation would still be required.
This keyword could also be used to create a new class :
empty class MyInterface()
I understand this can be easily achieved by generating an empty implementation of an interface through the IDE but this keyword would make the code less verbose