When converting an old java Utils-style class (nev...
# getting-started
m
When converting an old java Utils-style class (never instantiated, only containing statics) to Kotlin, do you typically: 1. remove the Utils class completely, and move those methods up to file-level (converting to use extension functions where possible/appropriate) 2. convert the Utils class to use
object
modifier 3. keep the Utils class and put the methods in a
companion object
2️⃣ 5
1️⃣ 11
v
I follow the first step and then put a
@file:JvmName('...')
at the top of the Kotlin file so that the Java code accessing those methods don't change at all.
👆 2
👍 5