简体   繁体   English

将可空的GUID从C#移植到Java

[英]Porting nullable GUIDs from C# to Java

I am porting some C# code to the Android platform. 我正在将一些C#代码移植到Android平台。 The code makes heavy use of nullable GUIDs. 该代码大量使用可空的GUID。 I understand they don't exist in Java, so what would be the best way to implement this feature? 我知道它们不存在于Java中,那么实现此功能的最佳方法是什么? I am thinking of just using an "empty" GUID (00000000-0000-0000-0000-000000000000) to represent a null value. 我想只使用“空”GUID(00000000-0000-0000-0000-000000000000)来表示空值。

java.util.UUID is a class in Java, which means a reference to this type can have the value null . java.util.UUID是Java java.util.UUID的一个类,这意味着对此类型的引用可以具有null The C# type that can't be represented in Java is a non -nullable UUID. 无法用Java表示的C#类型是不可空的UUID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM