Is there any equivalent of C# Guid.Empty in Kotlin?
As far as I can understand it is platform specific. UUIDs are managed by this class. See if there is something you can use there.
There seems to be no UUID type in the Kotlin standard library. As mentioned above, JVM offers the
java.util.UUID class. In .NET,
Guid.Empty is simply the GUID consisting of all zeros. You can construct an equivalent UUID in JVM by calling the constructor with zero for both arguments (i.e.
UUID(0,0)), but there is no built-in constant for it like in .NET.
I believe the reason why it is defined as a constant in C# but not in Java is that
Guid is a value type in .NET. Value types in C# can always be default initialized to the all zeros value, with no option of hiding or customizing the default constructor. For a GUID, you will pretty much always want a randomly generated value, which means the default zero value should not be used. The constant
Guid.Empty thus represents the absence of a proper GUID value. In other words, you can think of it as the null value for GUID.
In Java, UUID is normal class, (a reference type), which means that like for all other classes, the default value is
null. Therefore, if you want to represent the absence of a UUID, you should use