Skip to content

Instantly share code, notes, and snippets.

@jorgecasariego
Last active March 21, 2019 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorgecasariego/c900d5416cb65e9cdc718dfce6c91056 to your computer and use it in GitHub Desktop.
Save jorgecasariego/c900d5416cb65e9cdc718dfce6c91056 to your computer and use it in GitHub Desktop.
class SmartPhone(
val manufacture: String?,
val model: String?,
val storage: String?,
val screenSize: String?) {
data class Builder(
var manufacture: String? = null,
var model: String? = null,
var storage: String? = null,
var screenSize: String? = null) {
fun manufacture(manufacture: String) = apply { this.manufacture = manufacture }
fun model(model: String) = apply { this.model = model }
fun storage(storage: String) = apply { this.storage = storage }
fun screenSize(screenSize: String) = apply { this.screenSize = screenSize }
fun build() = SmartPhone(manufacture, model, storage, screenSize)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment