Skip to content

Tag: kotlin

Getting a map and collectors error in kotlin function

I am trying to convert this java function to kotlin. I end up with the following: However on the line I get the following error: Answer You don’t need stream() in kotlin. The collections classes in kotlin provides all methods you need. (e.g. map, distinct, toMap). Here is the kotlin way to write your fu…

How to track a touch on the screen

I want to write a penalty shootout application, now I have set up the background and added the ball and the goalkeeper to the map. How do I make it so that when I tap on the screen, the ball follows my touch on the screen. How to do this? How to track the touch on the screen and enter

Convert Java loop to Kotlin [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 9 months ago. Improve this question I’m studying implementation with Kotlin. When I implement Kotlin version by below sit…

return throw exception in Kotlin

I have the following problem, I can’t return this exception. It’s giving an error 500 and doesn’t run this exception. I wish that when I entered the if it would already return this custom exception. KOTLIN JAVA Answer You need to use RestControllerAdvice or ControllerAdvice like