bruno.gsantos89
01/23/2018, 12:57 PMinterface Validator<in T> {
fun validate(input: T) : Boolean
}
class ValidatorImpl: Validator<String> {
override fun validate(input: String) = !input.isEmpty()
}
class ValidatorImpl2: Validator<String> {
override fun validate(input: String) = !input.isEmpty()
}
class Form {
fun validateForm(validator: Validator) { // 1 problem's here
}
}
In my case if i change validateForm to receive Validator<Any> when I pass a ValidatorImpl(). I receive a error because ValidatorImpl is not type Any, in Java I simple pass interface, but in kotlin by now without results.
Thank you!!!