ArrayMap

Iterates over every entry of the array and calls the closure function to work on the element of the array.

The returned value will be set at the same index in a new array and the new array will be returned

Method Signature

ArrayMap(array=[array], callback=[function:Function], parallel=[boolean], maxThreads=[integer], initialValue=[any])

Arguments

ArgumentTypeRequiredDescriptionDefault

array

array

true

The array to reduce

callback

function:Function

true

The function to invoke for each item. The function will be passed 3 arguments: the current item, and the current index, and the original array. You can alternatively pass a Java Function which will only receive the 1st arg. The function should return the value that will be set at the same index in the new array.

parallel

boolean

false

false

maxThreads

integer

false

initialValue

any

false

Examples

Last updated

Logo

Copyright & Register Trademark by Ortus Solutions, Corp & Ortus Software, LLC