How to mark unused parameters in Kotlin to avoid warnings?
Hi everyone! I just started learning Kotlin and am transitioning from Java. I encountered this problem: when overriding methods or implementing interfaces, some parameters are often not used in the function body. For example, I have an `OnClickListener` interface:
```kotlin
interface OnClickListener {
fun onClick(view: View, position: Int)
}
```
When I implement this interface, I often don't need the `view` parameter, but I have to specify it:
```kotlin
class MyClickListener : OnClickListener {
override fun onClick(view: View, position: Int) {
// Only use position
println("Clicked on item $position")
}
}
```
In IntelliJ IDEA I see the warning "Parameter 'view' is never used". This is annoying and clutters the code. In Java I could just
No answers yet.
Log in to leave an answer