A value class wraps a single value to add type-safety without runtime object overhead in many cases (it can be inlined). It’s useful for strong domain types like `UserId` vs `String`.
@JvmInline
value class UserId(val value: String)
fun loadUser(id: UserId) = id.value
Advanced answer
Deep dive
Expanding on the short answer — what usually matters in practice:
Context (tags): value-class, type-safety, domain
JVM: memory (heap/stack), GC, and what drives latency.
Contracts: equals/hashCode/toString, mutability and consequences.