# ArrayFlatMap

Maps each element and flattens the result one level.

```
 values = [ 1, 2, 3 ];
 values.flatMap( ( value ) => [ value, value * 10 ] );
 // [ 1, 10, 2, 20, 3, 30 ]
 
```

## Method Signature

```
ArrayFlatMap(array=[array], callback=[function:Function], parallel=[boolean], maxThreads=[any], virtual=[boolean])
```

### Arguments

| Argument     | Type                | Required | Description                                                                                                                                                                                                                               | Default |
| ------------ | ------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `array`      | `array`             | `true`   | The array to transform                                                                                                                                                                                                                    |         |
| `callback`   | `function:Function` | `true`   | <p>The function to invoke for each item. The function will be passed 3 arguments: the current item, and the<br>current index, and the original array. You can alternatively pass a Java Function which will only receive the 1st arg.</p> |         |
| `parallel`   | `boolean`           | `false`  | If true, the function will be invoked in parallel using multiple threads. Defaults to false.                                                                                                                                              | `false` |
| `maxThreads` | `any`               | `false`  | The maximum number of threads to use when parallel is true. If not provided the common thread pool will be used. If a boolean value is passed, it will be assigned as the virtual argument.                                               |         |
| `virtual`    | `boolean`           | `false`  | If true, the function will be invoked using virtual thread. Defaults to false. Ignored if parallel is false.                                                                                                                              | `false` |

## Examples

## Related

* [ArrayAppend](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayappend)
* [ArrayAvg](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayavg)
* [ArrayChunk](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraychunk)
* [ArrayClear](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayclear)
* [ArrayContains](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraycontains)
* [ArrayContainsNoCase](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraycontainsnocase)
* [ArrayDelete](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraydelete)
* [ArrayDeleteAt](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraydeleteat)
* [ArrayDeleteNoCase](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraydeletenocase)
* [ArrayEach](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayeach)
* [ArrayEvery](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayevery)
* [ArrayFilter](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayfilter)
* [ArrayFind](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayfind)
* [ArrayFindAll](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayfindall)
* [ArrayFindAllNoCase](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayfindallnocase)
* [ArrayFindFirst](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayfindfirst)
* [ArrayFindNoCase](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayfindnocase)
* [ArrayFirst](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayfirst)
* [ArrayFlatten](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayflatten)
* [ArrayGetMetadata](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraygetmetadata)
* [ArrayGroupBy](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraygroupby)
* [ArrayIndexExists](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayindexexists)
* [ArrayInsertAt](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayinsertat)
* [ArrayIsDefined](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayisdefined)
* [ArrayLast](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraylast)
* [ArrayMap](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraymap)
* [ArrayMax](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraymax)
* [ArrayMedian](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraymedian)
* [ArrayMerge](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraymerge)
* [ArrayMid](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraymid)
* [ArrayMin](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraymin)
* [ArrayNew](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraynew)
* [ArrayNone](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraynone)
* [ArrayPop](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraypop)
* [ArrayPrepend](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayprepend)
* [ArrayPush](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraypush)
* [ArrayRange](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayrange)
* [ArrayReduce](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayreduce)
* [ArrayReduceRight](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayreduceright)
* [ArrayReject](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayreject)
* [ArrayResize](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayresize)
* [ArrayReverse](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayreverse)
* [ArraySet](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayset)
* [ArrayShift](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayshift)
* [ArraySlice](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayslice)
* [ArraySome](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraysome)
* [ArraySort](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraysort)
* [ArraySplice](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraysplice)
* [ArraySum](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraysum)
* [ArraySwap](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayswap)
* [ArrayToList](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraytolist)
* [ArrayToStruct](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraytostruct)
* [ArrayTranspose](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arraytranspose)
* [ArrayUnique](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayunique)
* [ArrayUnshift](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayunshift)
* [ArrayZip](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/array/arrayzip)
