---
schema_version: "1"
id: 21936c18c3a17381d18683c3c45ec91f94ec7097018e44e88c76b33189813464
title: Arrays (dw::core::Arrays)
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.3/dw-arrays.md
canonical_url: https://docs.mulesoft.com/dataweave/2.3/dw-arrays
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 49ba92792d1e086e974652ea32e643346f08c00dc0d9439c0011a7f33a8dd566
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
---
product: DataWeave
version: 2.3
---

# Arrays (dw::core::Arrays)

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

This module contains helper functions for working with arrays.

To use this module, you must import it to your DataWeave code, for example, by adding the line
`import * from dw::core::Arrays` to the header of your DataWeave script.

## Functions

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-countby">countBy</a></p></td><td><p>Counts the elements in an array that match the results of a function.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-divideby">divideBy</a></p></td><td><p>Breaks up an array into sub-arrays that contain the specified number of elements.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-drop">drop</a></p></td><td><p>Drops the first <code>n</code> elements. It returns the original array when <code>n &lt;= 0</code> and an empty array when <code>n &gt; sizeOf(array)</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-dropwhile">dropWhile</a></p></td><td><p>Drops elements from the array while the condition is met but stops the selection process when it reaches an element that fails to satisfy the condition.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-every">every</a></p></td><td><p>Returns <code>true</code> if every element in the array matches the condition.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-firstwith">firstWith</a></p></td><td><p>Returns the first element that satisfies the condition, or returns <code>null</code> if no element meets the condition.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-indexof">indexOf</a></p></td><td><p>Returns the index of the first occurrence of an element within the array.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-indexwhere">indexWhere</a></p></td><td><p>Returns the index of the first occurrence of an element that matches a condition within the array.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-join">join</a></p></td><td><p>Joins two arrays of objects by a given ID criteria.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-leftjoin">leftJoin</a></p></td><td><p>Joins two arrays of objects by a given ID criteria.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-outerjoin">outerJoin</a></p></td><td><p>Joins two array of objects by a given <code>ID</code> criteria.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-partition">partition</a></p></td><td><p>Separates the array into the elements that satisfy the condition from those that do not.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-slice">slice</a></p></td><td><p>Selects the interval of elements that satisfy the condition: <code>from &lt;= indexOf(array) &lt; until</code></p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-some">some</a></p></td><td><p>Returns <code>true</code> if at least one element in the array matches the specified condition.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-splitat">splitAt</a></p></td><td><p>Splits an array into two at a given position.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-splitwhere">splitWhere</a></p></td><td><p>Splits an array into two at the first position where the condition is met.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-sumby">sumBy</a></p></td><td><p>Returns the sum of the values of the elements in an array.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-take">take</a></p></td><td><p>Selects the first <code>n</code> elements. It returns an empty array when <code>n &lt;= 0</code> and the original array when <code>n &gt; sizeOf(array)</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-takewhile">takeWhile</a></p></td><td><p>Selects elements from the array while the condition is met but stops the selection process when it reaches an element that fails to satisfy the condition.</p></td></tr></tbody></table>
