orEmpty
Full name: taxi.stdlib.orEmpty
Signature
declare extension function <T> orEmpty(source:T[]): T[]Description
Returns the source array unchanged if it is non-null, or an empty array if it is null.
Useful for safely chaining collection operations on potentially-null fields.
find { user: User } as {
roles: user.roles.orEmpty().joinToString(', ')
}Examples
Returns the collection unchanged when non-null. Use .orEmpty() to safely chain operations on nullable arrays.
Try it out
Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed