Sunday 15 June 2014

scala - How can I create an empty java.util.UUID object? -



scala - How can I create an empty java.util.UUID object? -

i don't know why can't find reply this, need pass blank uuid object in 1 of functions represent lack of uuid. uuid analagous form of

val x: ""

, empty string. i'm trying empty uuid. tried

uuid.fromstring("")

but received error, need valid uuid string.

edit: implementing in scala.

let me preface saying me much improve utilize option[uuid] instead, none representing empty uuid.

you can't utilize empty string, not conform uuid format, described here.

you could use

uuid.fromstring("00000000-0000-0000-0000-000000000000")

which same as

new uuid(0l, 0l)

but usage of arbitrary, , much improve signify absence or lack of uuid option.

java scala uuid

No comments:

Post a Comment