all

Full name: taxi.stdlib.all

Signature

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

Description

Returns true if every item in the collection satisfies the predicate, or false if any item does not.

Returns true for an empty collection (vacuous truth).

// Check if every task in a sprint is complete
find { sprint: Sprint } as {
   allDone: Boolean = sprint.tasks.all((task) -> task.isComplete)
}

Examples

Returns true when every item in the collection 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

Returns false when at least one item does not satisfy 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