I'm wondering if contracts would help to get rid o...
# announcements
b
I'm wondering if contracts would help to get rid of that !!:
Copy code
dtos.filter { it.field != null }
    .map { OtherDto(it.field!!, it.otherField, it.anotherField) }
w
it will, but I just what to know how can that even happen?
g
It will not
Instead you can combine both filter and map in single mapNonNull and just do check there. It's also more efficient