DEV Community

Discussion on: The hidden Kotlin gem you didn't think you'll love: Deprecations with ReplaceWith

Collapse
 
androiddeveloperlb profile image
AndroidDeveloperLB

Since Java can use Kotlin, how can I make it work for Java too? For example, I have a few helper functions for Java, as this one:

@Deprecated(message = "", replaceWith = ReplaceWith("collection.isNullOrEmpty()"))
@JvmStatic
fun isEmpty(collection: Collection<*>?): Boolean = collection.isNullOrEmpty()

Can Java use the functions from Kotlin, that should be suggested here?