Created
December 13, 2017 00:52
-
-
Save ar-android/6376fe4fb326c73bd785aea377c9c8f9 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
class WeatherBuilder{ | |
var currentDegrees: String? = null | |
var currentLocation: String? = null | |
val forecast = mutableListOf<Forecast>() | |
fun forecast(block: ForecastBuilder.() -> Unit){ | |
forecast.add(ForecastBuilder().apply(block).build()) | |
} | |
fun build(): Weather = Weather(currentDegrees, currentLocation, forecast) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment