and suddenly compared to java we have so many diff...
# announcements
c
and suddenly compared to java we have so many different ways to do even simple things... not sure what i like best/is most idiomatic
Copy code
fun serialize1(obj: Any): String {
        val sr = StringResult()
        marshaller.marshal(obj, sr)
        return sr.toString()
    }

    fun serialize2(obj: Any) =
        StringResult().apply {
            marshaller.marshal(obj, this)
        }.toString()

    fun serialize3(obj: Any) =
        with (StringResult()) {
            marshaller.marshal(obj, this)
            return toString()
        }

    fun serialize4(obj: Any) =
        StringResult().let {
            marshaller.marshal(obj, it)
            return@let it.toString()
        }