Fix a bug in the following piece of code.
Computer scienceProgramming languagesKotlinObject-oriented programmingObject-oriented programming usage
Destructuring declarations
ComponentN
Report a typo
Write a program in Kotlin
class Event(val id: Int, val x: Int, val y: Int, val isLongClick: Boolean) {
operator fun component1() : Int = y
operator fun component2() = x
operator fun component3() : Boolean = isLongClick
operator fun component4() : Int = id
}
fun isEventLongClicked(events: MutableList<Event>, eventId: Int): Boolean? {
for ((id, x, y, isLongClick) in events) {
if ( id == eventId) return isLongClick
}
return null
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.