I don't know why I can't find the answer to this, but I need to pass a blank UUID object in one of my functions to represent a lack of UUID. What is the UUID analagous form of
val x: "" , which would be an empty string. I'm essentially trying to get an empty UUID. I tried
UUID.fromString("") but received an error, as you need a valid UUID string.
EDIT: I am implementing this in Scala.
You can't use an empty String , as it does not conform to the UUID format, described here. But the usage of that would be arbitrary, and it would be much better to signify the absence or lack of a UUID with Option . Thanks!
You can create a nil UUID from a hex string of zeros in the canonical format.
Let me preface this by saying it would be much better to use Option[UUID] instead, with None representing an empty UUID.
You can't use an empty String, as it does not conform to the UUID format, described here.
You could use
UUID.fromString("00000000-0000-0000-0000-000000000000") Which would be the same as
new UUID(0L, 0L) But the usage of that would be arbitrary, and it would be much better to signify the absence or lack of a UUID with Option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With