Is it possible to create a generic function extens...
# getting-started
c
Is it possible to create a generic function extension? I've tried this but it doesn't work:
Copy code
fun List<E>.getDifference(other: List<E>) = this.union(other) - this.intersect(other)
s
Copy code
fun <E> List<E>.getDifference(other: List<E>) = this.union(other) - this.intersect(other)
🙏 1
c
Oh, cool, thanks! I didn't know you could specify generic types like this, I'm still learning 😄
s
definitely a bit of a java-ism preserved in Kotlin