---
schema_version: "1"
id: 92c447778d6cba2b4346df46ca85a1a84c72828a1d083cde507d0340dd940711
title: partition
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.3/dw-arrays-functions-partition.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.3/dw-arrays-functions-partition
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 804f9715bc53b4d030bbb073a2ccaf651e0b7671e56558727f4697b41290a8a4
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
# partition

## [](#partition1)partition(Array<T>, (item: T) -> Boolean): { success: Array<T>, failure: Array<T> }

条件を満たす要素と条件を満たさない要素に配列を分割します。

_DataWeave 2.2.0 で導入されました。Mule 4.2 以降でサポートされます。_​

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>array</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">分割する要素の配列。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>condition</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">配列の要素の照合に使用される条件 (式)。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、入力配列内で見つかった数字を分割します。偶数は、ラムダ式 ​`(item) → isEven(item)`​ で設定された条件に一致します。奇数は一致しません。関数の出力オブジェクト内では ​`"success"`​ キーと ​`"failure"`​ キーが生成されます。

#### [](#ソース)ソース

```DataWeave
%dw 2.0
import * from dw::core::Arrays
output application/json
var arr = [0,1,2,3,4,5]
---
arr partition (item) -> isEven(item)
```

#### [](#出力)出力

```json
{
  "success": [
    0,
    2,
    4
  ],
  "failure": [
    1,
    3,
    5
  ]
}
```