Kotlin 1.2 Language DocumentationBigInteger ; Arithmetic and bitwise operator functions: Binary operators + , - , * , / , % and infix functions and , or , xor , shl , shr ; Unary operators - , ++ , -- , and a function inv . New functions const external override lateinit tailrec vararg suspend inner enum / annotation companion inline infix operator data Place all annotations before modifiers: @Named("Foo") private val foo: Foo Unless Declare a function as infix only when it works on two objects which play a similar role. Good examples: and , to , zip . Bad example: add . Don't declare a method as infix if it mutates the receiver0 码力 | 333 页 | 2.22 MB | 1 年前3
Kotlin Language Documentation 1.9.20Restrictions for public API inline functions Operator overloading Unary operations Binary operations Infix calls for named functions Type-safe builders How it works Scope control: @DslMarker Full definition operator makes it easier to understand when an open-ended range is declared. If you use the until infix function, it's easy to make the mistake of assuming that the upper bound is included. Here is an string. Improvements to the existing API Version 1.6.0 added the infix extension function for Comparable.compareTo(). You can now use the infix form for comparing two objects for order: class WrappedText(val0 码力 | 1299 页 | 32.44 MB | 1 年前3
Kotlin language specification
Version 1.9-rfc+0.1T A I L R E C : 'tailrec' OP E R A T OR : 'operator' I N L I N E : 'inline' I N F I X : 'infix' E X T E R N A L : 'external' SU SP E N D : 'suspend' OV E R R I D E : 'override' A B ST R d i fi er {N L }) | a n n o t a t i o n fu nc ti o nM o d i fi e r : 'tailrec' | 'operator' | 'infix' | 'inline' | 'external' | 'suspend' p r o p e r ty M o d i fi e r : 'const' i nh e r i ta nc e 'crossinline' | 'data' | 'dynamic' | 'enum' | 'external' | 'final' | 'finally' | 'get' | 'import' | 'infix' | 'init' | 'inline' | 'inner' | 'internal' | 'lateinit' | 'noinline' | 'open' | 'operator' | 'out'0 码力 | 38 页 | 358.59 KB | 1 年前3
Kotlin Language Documentation 1.3const external override lateinit tailrec vararg suspend inner enum / annotation companion inline infix operator data Place all annotations before modi�ers: @Named("Foo") private val foo: Foo Unless array with * ): val a = arrayOf(1, 2, 3) val list = asList(-1, 0, *a, 4) Functions marked with the infix keyword can also be called using the in�x notation (omitting the dot and the parentheses for the number of arguments (Varargs) In�x notation — — — 161 infix fun Int.shl(x: Int): Int { ... } // calling the function using the infix notation 1 shl 2 // is the same as 1.shl(2) In�x function calls0 码力 | 597 页 | 3.61 MB | 1 年前3
Kotlin 1.9.10 官方文档 中文版
operator makes it easier to understand when an open-ended range is declared. If you use the until infix function, it's easy to make the mistake of assuming that the upper bound is included. Here is an treated as a literal string. 既有 API 的改进 Version 1.6.0 added the infix extension function for Comparable.compareTo() . You can now use the infix form for comparing two objects for order: class WrappedText(val vararg suspend inner enum / annotation / fun // 在 `fun interface` 中是修饰符 companion inline/ value infix operator data 将所有注解放在修饰符前: @Named("Foo") private val foo: Foo 除非你在编写库,否则请省略多余的修饰符(例如 public0 码力 | 3753 页 | 29.69 MB | 1 年前3
Kotlin 官方文档中文版 v1.9operator makes it easier to understand when an open-ended range is declared. If you use the until infix function, it's easy to make the mistake of assuming that the upper bound is included. Here is an ed as a literal string. 既有 API 的改进 Version 1.6.0 added the infix extension function for Comparable.compareTo() . You can now use the infix form for comparing two objects for order: class WrappedText(val vararg suspend inner enum / annotation / fun // 在 `fun interface` 中是修饰符 companion inline/ value infix operator data 将所有注解放在修饰符前: @Named("Foo") private val foo: Foo 除非你在编写库,否则请省略多余的修饰符(例如 public0 码力 | 2049 页 | 45.06 MB | 1 年前3
Kotlin language specification
Version 1.9-rfc+0.1T A I L R E C : 'tailrec' OP E R A T OR : 'operator' I N L I N E : 'inline' I N F I X : 'infix' E X T E R N A L : 'external' SU SP E N D : 'suspend' OV E R R I D E : 'override' A B ST R d i fi er {N L }) | a n n o t a t i o n fu nc ti o nM o d i fi e r : 'tailrec' | 'operator' | 'infix' | 'inline' | 'external' | 'suspend' p r o p e r ty M o d i fi e r : 'const' i nh e r i ta nc e 'crossinline' | 'data' | 'dynamic' | 'enum' | 'external' | 'final' | 'finally' | 'get' | 'import' | 'infix' | 'init' | 'inline' | 'inner' | 'internal' | 'lateinit' | 'noinline' | 'open' | 'operator' | 'out'0 码力 | 310 页 | 1.39 MB | 1 年前3
共 7 条
- 1













