seriesOrder: 8 The problem: avoiding unnecessary evaluations Introducing “Delay” Introducing “Run” When is delay called? “Delay” changes the signature of “Combine” Understand...
伴生对象和静态成员 fun main ( args : Array < String >) { val latitude = Latitude . ofDouble ( 3.0 ) val latitude2 = Latitude . ofLatitude ( latitude ) printl...
8.2.4 函数参数 8.2.4 函数参数 函数参数使用 Pascal 表示法定义,即 name: type。参数用逗号隔开。每个参数必须显式指定其类型。 fun powerOf ( number : Int , exponent : Int ): Int { return Math . pow ( numb...
Retrieving Single Elements Retrieving by position Retrieving by condition Random element Checking existence Retrieving Single Elements Kotlin collections provide a set of f...
数据结构约束 Next step 数据结构约束 Some data structures may require a part of operations not to be executed concurrently, such as single-producer single-consumer queues. Lincheck provides...
泛型preference委托 泛型preference委托 现在我们已经是泛型专家了,为什么不扩展LongPreference 为支持所有Shared Preferences 支持的类型呢?我们来创建一个Preference 委托: class Preference < T >( val context : Context , val n...