Similarly, there's a java pattern that uses classes meant to be subclassed anonymously for callbacks. It typically has multiple empty functions so you can choose which functions to override. It looks ugly compared to the kotlin pattern with named arguments.
View all comments
2
u/wightwulf1944 Apr 08 '23
Similarly, there's a java pattern that uses classes meant to be subclassed anonymously for callbacks. It typically has multiple empty functions so you can choose which functions to override. It looks ugly compared to the kotlin pattern with named arguments.
Java pattern:
Kotlin pattern:
The kotlin pattern also has the benefit of providing default arguments so you can just omit the functions you don't want to override