Kotlin编译器是否使用
java.lang.String.format("Hello, %s!", name)
or is there some other mechanism?
举个例子,如果我有这样一门课:
class Client {
val firstName: String
val lastName: String
val fullName: String
get() = "$firstName $lastName"
}
Will this getter return a cached string or will it try to build a new string? Should I use lazyOf delegate instead?
我知道除非有数以百万计的fullName
次呼叫,否则不会有性能问题,但除了如何使用它之外,我还没有找到有关此功能的文档.