O'Reilly logo
  • MICHAEL MASLENKO thinks this is interesting:

If your event listener needs to unsubscribe itself while handling an event, you can’t use a lambda for that. Use an anonymous object to implement a listener, instead. In an anonymous object, the this keyword refers to the instance of that object, and you can pass it to the API that removes the listener

From

Cover of Kotlin in Action

Note

7