Files
kb/wiki/tech/kotlin.md
T
hermes 1f0201a80f kb: initialize KB v4 — migrated 2,815 links-posts + 19 tech notes + SCHEMA.md + log.md
- 3-layer architecture: raw (monthly buckets) → wiki (domain subdirs) → SCHEMA
- Privacy: repo set to private (public-safe content only)
- Sync: daily Links App sync via raw/links/YYYY-MM/
- Design: converged via Grok 4.5 2-round review
2026-07-13 12:06:45 +10:00

905 B

title, created, updated, type, tags, external
title created updated type tags external
Kotlin 2021-05-07 2021-05-07 summary
tech
reference
https://github.com/wahyd4/knowledge/blob/master/categories/kotlin.md

Kotlin

Some tips

Builder mode in kotlin

class Car(
  val model: String?,
  val color: String?,
  val type: String?) {

    data class Builder(
      var model: String? = null,
      var color: String = "pink",
      var type: String? = null) {

        fun model(model: String) = apply { this.model = model }
        fun color(color: String) = apply { this.color = color }
        fun type(type: String) = apply { this.type = type }
        fun build() = Car(model, color, type)
    }
}
//use
val car = Car.Builder()
  .model("Ford Focus")
  .color("Black")
  .type("Type")
  .build()

Based on stackoverflow