# collectionMap

Maps values in a collection




### Syntax

```
collectionMap(collection, closure [, parallel] [, maxThreads]) returns any
```






## Argument Reference

| Name | Type | Required | Default | Description | Values |
| --- | --- | --- | --- | --- | --- |
| collection | any | Yes |  |  |  |
| closure | function | Yes |  |  |  |
| parallel | boolean | No |  |  |  |
| maxThreads | numeric | No | 20 |  |  |





## CFML Engine Support

The collectionMap function is supported on the following CFML engines:

| Engine | Minimum Version | Notes |
| --- | --- | --- |
| Lucee |  |  |




## Examples


### Return users which names are mapped to one value only



```
coll = [{
    id: 0,
    firstname: 'Arthur',
    name: 'Dent'
},{
    id: 1,
    firstname: 'Harry',
    name: 'Potter'
},{
    id: 2,
    firstname: 'Peter',
    name: 'Jackson'
}];
users = collectionMap(coll,function(item) {
    return {
        id: item.id,
        fullname: item.firstname&' '&item.name
    };
});
for(user in users) {
    writeOutput(user.fullname&', ');
}
```
Expected Result: Arthur Dent, Harry Potter, Peter Jackson,





## Related Tags and Functions

[collectionEvery](https://cfdocs.org/collectionEvery.md)
[collectionEach](https://cfdocs.org/collectionEach.md)
[collectionFilter](https://cfdocs.org/collectionFilter.md)
[collectionReduce](https://cfdocs.org/collectionReduce.md)
[collectionSome](https://cfdocs.org/collectionSome.md)




The human version of this document can be found here: [https://cfdocs.org/collectionmap](https://cfdocs.org/collectionmap) which is part of the cfdocs.org repository. Project created by [Pete Freitag](https://www.petefreitag.com) and sponsored by [Foundeo Inc.](https://foundeo.com/)
