摘要: In Kotlin, the type system distinguishes between references that can hold null (nullable references) and those that cannot (non-nullable references). 阅读全文
posted @ 2023-11-27 23:16 Otlpy 阅读(47) 评论(0) 推荐(0)
摘要: A higher-order function is a function that takes functions as parameters, or returns a function. fun <T, R> Collection<T>.fold( initial: R, combine: ( 阅读全文
posted @ 2023-11-21 22:58 Otlpy 阅读(30) 评论(0) 推荐(0)
摘要: Function parameters can have default values, which are used when you skip the corresponding argument. This reduces the number of overloads: fun read( 阅读全文
posted @ 2023-11-19 22:48 Otlpy 阅读(18) 评论(0) 推荐(0)
摘要: Properties in Kotlin classes can be declared either as mutable, using the var keyword, or as read-only, using the val keyword. // full syntax for decl 阅读全文
posted @ 2023-11-16 16:20 Otlpy 阅读(18) 评论(0) 推荐(0)
摘要: A class in Kotlin has a primary constructor and possibly one or more secondary constructors. // primary constructor class Person(val name: String) { v 阅读全文
posted @ 2023-11-13 15:13 Otlpy 阅读(18) 评论(0) 推荐(0)