I have an interface class written in kotlin that is also implemented in a java class. one of the fields on the interface is a StateFlow. Now to override this field in kotlin classes is straight forward but what is the proper way to override this in java class ?
Here is the kotlin code:
interface myInterface {
val myvar : StateFlow<TargetClass>
class TargetClass( val name:String? = null)
}
To implement this interface in Java I tried to create a private setter and public getter like
private _myvar = new MutableStateFlow<>(new TargetClass(null))
@Override
public StateFlow<TargetClass> getMyVar() {return _myvar}
but this doesnt compile. What is the correct (and preffered / best) approch to handle this ?