Created
February 17, 2026 01:14
-
-
Save skydoves/219afb418ae877e6ec3e5d633d8856e1 to your computer and use it in GitHub Desktop.
Value Class Boxing Scenarios in Kotlin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val id1: Any = UserId("abc") // Stored as Any, forces boxing | |
| val id2: UserId? = UserId("def") // Nullable type can force boxing | |
| val listOfIds = listOf(UserId("1")) // Generic collection, forces boxing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment