Luke Sleeman
val myList = listOf { add("Blah") add("Foo") if(somethingIsTrue) { add("More") add("Stuff") } }
tseisel
buildList
Czar
val myList = sequence { yield("Blah") yield("Foo") if (somethingIsTrue) { yield("More") yield("Stuff") } }.toList()
val myList = mutableListOf<String>().apply { add("Blah") add("Foo") if(somethingIsTrue) { add("More") add("Stuff") } }.toList()
Stephan Schroeder
val myList = mutableListOf<String>( "Blah", "Foo" ).apply { if(somethingIsTrue) { add("More") add("Stuff") } }.toList()
A modern programming language that makes developers happier.