So on Java I like to implement an interface directly on a local variable like this for example.
private SensorEventListener sensorEventListener = new SensorEventListener() { @Override public void onSensorChanged(SensorEvent event) { //implement here } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { //implement here } }; So that later I can add that listener directly and be able to remove the listener afterwards.
I'm trying to achieve the same idea on Kotlin, to have a var that implement the interface, without having to define a new class that extents that.
Is it possible? What is the semantic?