gpt4 book ai didi

kotlin - .getDefaultInstance() 和 .newBuilder().build() 之间有区别吗?

转载 作者:行者123 更新时间:2023-12-05 01:12:13 25 4
gpt4 key购买 nike

在 Kotlin 中使用 gRPC API 执行此操作。这两者有区别吗?

ApiRequest.newBuilder().build()

ApiRequest.getDefaultInstance()

谢谢

最佳答案

来自 https://developers.google.com/protocol-buffers/docs/reference/java-generated

static Foo getDefaultInstance(): Returns the singleton instance of Foo. This instance's contents are identical to what you'd get if you called Foo.newBuilder().build() (so all singular fields are unset and all repeated fields are empty). Note that the default instance of a message can be used as a factory by calling its newBuilderForType() method.

关于kotlin - .getDefaultInstance() 和 .newBuilder().build() 之间有区别吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62391475/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com