The Kotlin standard library provides the runtime definitions and APIs that make ordinary Kotlin code practical. It includes fundamental types such as Int and String, collection types such as List, Map, and Sequence, and extensions to Java APIs. Functional collection operations let Kotlin combine concise lambdas with familiar object-oriented code. section 1.5.2 section 1.2.3
messages
.filter { it.body.isNotBlank() && !it.isRead }
.map(Message::sender)
.distinct()
.sortedBy(Sender::name)
A collection pipeline filters unread messages with nonblank bodies, extracts senders, removes duplicates, and sorts by sender name. section 1.2.3
Each operation expresses one transformation: filter keeps matching messages, map converts messages to senders, distinct removes repeated values, and sortedBy orders the result. Lambdas and member references keep the code compact without requiring manual traversal and aggregation. section 1.2.3 section 6.1
Use the library in two closely related ways:
- Rely on fundamental Kotlin classes and extensions that compiled JVM programs need at runtime. section 1.5.2
- Apply standard collection functions such as filter and map, customizing behavior with lambdas. section 6.1
- Let Gradle or Maven manage Kotlin runtime and standard-library dependencies in typical mixed Kotlin and Java projects. section 1.5.2
