Link Search Menu Expand Document (external link)

Kotlin


Aufgaben

Collections / Aggregate Operations

  • finde eine leicht zu verstehende Beschreibung/Definition für fold und reduce.

IntelliJ-Integration

Maven

Mit der Property kotlin.compiler.jvmTarget wird die Eigenschaft in IntelliJ automatisch gesetzt (Projekt auswählen → ⌘+↓ → Modules → Kotlin Target platform).

<properties>
    <kotlin.compiler.jvmTarget>17</kotlin.compiler.jvmTarget>
</properties>

pom.xml: Verwendung des Kotlin Compiler-Arguments jvmTarget.

Scope functions

function context object return value use case
run this (lambda receiver) lambda result …recommended for lambdas that mainly operate on the object members: call its functions or assign properties…
with this (lambda receiver) lambda result Calling multiple methods on an object instance (with)
apply this (lambda receiver) context object Configuring properties of an object (apply)
let it (lambda argument) lambda result …when the object is mostly used as an argument in function calls…
also it (lambda argument) context object …also better if you use multiple variables in the code block…