Inline keyword without higher-order function in Kotlin

Viewed 61

There's listOf() function in Collections.kt found in Kotlin source code.

/**
 * Returns an empty read-only list.  The returned list is serializable (JVM).
 * @sample samples.collections.Collections.Lists.emptyReadOnlyList
 */
@kotlin.internal.InlineOnly
public inline fun <T> listOf(): List<T> = emptyList()

What is the benefit or purpose of inline keyword with a function which is not a higher-order function? How lack of this keyword would introduce runtime overhead at call-sites?

0 Answers
Related