apatrida
09/30/2015, 4:51 PMlet
that return the original object, so if I want to allocate something and adjust it, but still return it without fail:
public inline fun <T> T.initializedBy(initWith: (T) -> Unit): T {
initWith(this)
return this
}
val mapThing = ImmutableSettingsBuilder() initializedBy {
it.put("default" to "value")
it.put("other" to "value")
}.build()
You can do the same with let
but it COULD change the result type.