---
schema_version: "1"
id: bbba5dbc84f4e8417b02cc3887c95c5331717e26a50b3a814b0a6954508249bf
title: indexWhere
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.5/dw-arrays-functions-indexwhere.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.5/dw-arrays-functions-indexwhere
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 17e34923ca1c62f2e324db255423b5c71d8309977fc874c6f90916f5ad6a68dd
description: MuleSoft Documentation Site
release: "2.5"
latest: false
---
# indexWhere

## [](#indexwhere1)indexWhere<T>(array: Array<T>, condition: (item: T) -> Boolean): Number

配列内で条件に一致する最初に出現する要素のインデックスを返します。条件を満たす要素がない場合は、​`-1`​ を返します。

_DataWeave バージョン 2.2.0 で導入されました。_

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

<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) → item startsWith "Jul"`​) に一致する値のインデックスを返します。

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

```DataWeave
%dw 2.0
import * from dw::core::Arrays
output application/json
var users = ["Mariano", "Leandro", "Julian"]
---
users indexWhere (item) -> item startsWith "Jul"
```

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

```json
2
```

## [](#indexwhere2)indexWhere(array: Null, condition: (item: Nothing) -> Any): Null

`indexWhere`​ を ​`null`​ 値に使用できるようにするヘルパー関数。

_DataWeave バージョン 2.4.0 で導入されました。_