George
06/10/2024, 4:39 PMCLOVIS
06/11/2024, 3:39 PMGeorge
06/11/2024, 4:47 PMJørund Amsen
06/20/2024, 6:49 AMdata class Person(val name:String)
data class PersonDto(val name:String)
fun Person.toDto(): PersonDto {...}
fun toDto(person: Person): PersonDto {...}
val dtos = listOf(Person("Jerry")).map (::toDto)
val dtos2 = listOf(Person("Tom")).map { it.toDto() }
Im also a fan of function references so that might be simple preference. But input-output functions just feel more.. modular?
However when the arguments pile up, like romans example with string replace, and especially if it modifies the object I'm much more inclined to make it an extension function