corda - Corda:类 [Party] 和 [Party?] 有什么区别?
问题描述
帐户中的 [Party] 和 [Party?] 有什么区别?
这是关于帐户的链接:https ://github.com/corda/accounts/tree/release/pre/1/v4
我可以将 [Party?] 的对象转换为 [Party] 吗?
解决方案
[Party?] 表示对象可以为 null 或 [Party] 类对象。这是 Kotlin 的方式来指示对象可以为 null 或特定对象。
在代码中:
// Returns the Party which hosts the account specified by account ID.
fun hostForAccount(accountId: UUID): Party?
这基本上意味着返回类型可以是 null 或 [Party] 对象。
PS:【派对】是Corda类
推荐阅读
- ios - 使用全局变量在 ViewController 之间传递数据的缺点是什么?
- sql-server - Sql Server 收缩 temp db mdf 和 ndf
- c# - 无法在 EF Code First 上创建组合主键
- java - 如何调用 Spring Security Provider?
- python - 有没有办法在python中聚合一定时间范围内的订单?
- android - 是否可以使用 Firebase Cloud Functions on Realtime 数据库创建覆盖多个节点的原子事务?
- javascript - 来自 React v4 中事件处理程序的 URL 重定向
- python - 如何在没有黑色背景的情况下将 pygame 中的 png 图像作为精灵上传?
- excel - 选择具有多列的范围时,Countifs 不起作用
- docker - 启动 docker 时,“VirtualBox 配置了多个具有相同 IP 的仅主机适配器”