toJavaUuid

Converts this kotlin.uuid.Uuid value to the corresponding java.util.UUID value.

This function is convenient when one has a Kotlin uuid and needs to interact with an API that accepts a Java uuid.

Since Kotlin

2.0

Samples

import kotlin.uuid.*

fun main() { 
   //sampleStart 
   val hexString = "550e8400e29b41d4a716446655440000"
val kotlinUuid = Uuid.parseHex(hexString)
val javaUuid = kotlinUuid.toJavaUuid()

println(javaUuid) // 550e8400-e29b-41d4-a716-446655440000
println(javaUuid.version()) // 4 
   //sampleEnd
}