I am new to Kotlin. Could you explain me what is the meaning of the "kotlin.String!" type and how could I make the following code to compile?
fun withDefault<A>(computation: () -> A, default: A) =
try { computation() } catch (e: Exception) { default }
fun getHostname1() = withDefault(InetAddress.getLocalHost().getCanonicalHostName, "localhost")
The compiler prints the following message:
Kotlin: Type inference failed: fun <A> withDefault(computation: () -> A, default: A): A
cannot be applied to
(kotlin.String!,kotlin.String)
Thank You.