Hello. How can i convert this java interface ``` ...
# announcements
s
Hello. How can i convert this java interface
Copy code
public interface Listener{
        void success(Model model);

        void error();
    }
to make it useable from kotlin without annonymous inner class? Do I need to declare interface with only one method? Or there is some other workaround? I want to use it like this
Copy code
modelManager.identifyModelWithCameraUrl(cameraUrl) { cameraModel ->
            
        }
m
i guess you could write some factory function that takes two blocks and handles the anonymous class creation for you, so can call it like
makeListener(success = { model -> TODO() }, error = { TODO() })
. if that's nicer than just passing an anonymous class or not is another question. the same approach would work in java 8 too