Skip to content

Instantly share code, notes, and snippets.

@adam-arold
Created September 11, 2017 16:34
Show Gist options
  • Save adam-arold/d81a7681415e4988c72fd23fd923efcd to your computer and use it in GitHub Desktop.
Save adam-arold/d81a7681415e4988c72fd23fd923efcd to your computer and use it in GitHub Desktop.
Kotlin user
data class KotlinUser(val firstName: String,
val lastName: String,
val addresses: List<Address> = listOf()) {
data class Address(val city: String)
/**
* This is the same as in `JavaUser`.
*/
fun getFirstAddressNoInference(): Address {
val firstAddress: Address = addresses.first()
return firstAddress
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment