<In Kotlin, can I have a conditional builder eleme...
# stackoverflow
u
In Kotlin, can I have a conditional builder element on a collection? Currently I have a query that looks something like this: override suspend fun getExternalTestsForProfile(profileKey: String, take: Int?): List { RealmDb.useRealm { where(RealmExternalTest::class.java) .sort(RealmExternalTestFields.CREATED_AT, Sort.DESCENDING) .findAll() I want to have functionality so that if take is null, it will fetch all elements in the collection, but if an Int is supplied, it will take and map in that case only. So my...