ArrayEvery
Returns true if every closure returns true, otherwise false
Method Signature
Arguments
array
array
true
The array to reduce
callback
function:Predicate
true
The function to invoke for each item. The function will be passed 3 arguments: the value, the index, the array. You can alternatively pass a Java Predicate which will only receive the 1st arg.
parallel
boolean
false
Specifies whether the items can be executed in parallel
false
maxThreads
integer
false
The maximum number of threads to use when parallel = true
initialValue
any
false
Examples
Example for positive result
Checks whether all items in an array are greater than 2 and outputs true because all of them fulfill the requirement.
Result: true
Example for negative result
Checks whether all items in an array are greater than 2 and outputs false because some of them do not fulfill the requirement.
Result: false
Additional Examples
Related
Last updated
Was this helpful?