Marcin Wisniowski
12/11/2017, 6:06 AMmap
or pass a method reference:
listOf("1", "2", "3").map { it.toInt() }
listOf("1", "2", "3").map(String::toInt)
Is either of these considered better? (Or am I overthinking this?)Czar
12/11/2017, 7:10 AMCzar
12/11/2017, 10:16 AM{ it.toInt() }
when it actually improves readability. My MR argument mostly applies to apply
, also
, run
, etc. map { it.toSomething() }
reads well.Czar
12/11/2017, 10:18 AMmyObject.run(SomeService::doSomethingWithObject)
is better IMO than myObject.run { SomeService.doSomethingWithObject(it) }
Czar
12/11/2017, 1:04 PMMarcin Wisniowski
12/12/2017, 1:21 AMpablisco
12/15/2017, 9:19 AMmap it to Int
so a bit more like natural language.
so it depends on the case.cygnus
12/17/2017, 9:35 PM