Davio
09/16/2024, 2:08 PMinterface Processor<T> : (T) -> T, (T) -> Boolean
The error message is Type parameter R of 'Function' has inconsistent values: T, Boolean
Does anybody know if this is even possible or does anyone have an alternative other than reverting to Java's Predicate<T>
for the second part?Alejandro Serrano.Mena
09/16/2024, 2:11 PM(T) -> T
and (T) -> Boolean
, it means that T
must be equal to Boolean
Alejandro Serrano.Mena
09/16/2024, 2:12 PM(T) -> T
, and another (T) -> Boolean
, I think a regular class would work betterDavio
09/16/2024, 2:16 PMinvoke
and you can't have 2 invokes with different output I guessDaniel Pitts
09/16/2024, 2:36 PMinterface Foo<T>
class Bar : Foo<String>, Foo<Int>
This fails, no method signature at all to worry about.
My guess is that this is a consequence of type erasure.Youssef Shoaib [MOD]
09/16/2024, 4:26 PMProcessor
? What should myProcessor(tValue)
return? I think what you want is more like
interface Processor<T> {
fun transform(t: T): T
fun predicate(t: T): Boolean
}
And then use it as myProcessor::transform
and myProcessor::predicate
when need be