Join Slack
Powered by
Can Kotlin implement the same interface (with diff...
# getting-started
b
birgersp
11/29/2017, 2:18 PM
Can Kotlin implement the same interface (with different generic types) multiple times? After some experiments, I guess not. If that's true, how can I work around it?
birgersp
11/29/2017, 2:19 PM
Basically this is the problem I'm having is this:
https://stackoverflow.com/questions/1297972/how-to-make-a-java-class-that-implements-one-interface-with-two-generic-types
k
karelpeeters
11/29/2017, 2:21 PM
No, because at runtime there's no difference between
Consumer<String>
and
Consumer<Int>
, so the methods would collide.
b
birgersp
11/29/2017, 2:25 PM
What's the most professional way to work around this?
k
karelpeeters
11/29/2017, 2:26 PM
The answers on the question you linked all apply to Kotlin as well.
3
Views
Open in Slack
Previous
Next