Created
September 19, 2018 06:03
-
-
Save Sottti/974eaae1c7ad157624f89979a8ff3db5 to your computer and use it in GitHub Desktop.
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
data class User( | |
val name: String, | |
val surname: String = "", | |
val address: String = "") { | |
class Builder { | |
private lateinit var name : String | |
private var surname : String = "" | |
private var address : String = "" | |
fun name(name: String) = apply { this.name = name } | |
fun surname(surname: String) = apply { this.surname = surname } | |
fun address(address: String) = apply { this.address = address } | |
fun build() = User( | |
name, | |
surname, | |
address | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment