any

Full name: taxi.stdlib.any

Signature

declare extension function <T> any(collection: T[], predicate: (T) -> Boolean): Boolean

Description

Returns true if at least one item in the collection satisfies the predicate, or false if none do.

Returns false for an empty collection.

// Check whether any order in a batch is flagged
find { batch: OrderBatch } as {
   needsAttention: Boolean = batch.orders.any((order) -> order.isFlagged)
}

Examples

Returns true when at least one item satisfies the predicate.

Try it out

Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed
Next
Welcome to Taxi