i'm sure there is a pretty way to express sth. lik...
# getting-started
d
i'm sure there is a pretty way to express sth. like this in kotlin?
return if (sortedItems.isEmpty()) null else itemMapper.mapDto(sortedItems.first())
m
Maybe something like this?
Copy code
return sortedItems.firstOrNull()?.let { itemMapper.mapDto(it) }
d
nice, thx