LedgerTransaction.findCommand - corda

corda / net.corda.core.transactions / LedgerTransaction / findCommand

# findCommand

`fun <T : CommandData> findCommand(clazz: Class<T>, predicate: Predicate<T>): Command<T>`

Helper to simplify finding a single Command items according to a Predicate.

### Parameters

`clazz` - The class type used for filtering via an Class.isInstance check. clazz must be an extension of CommandData.

`predicate` - A filtering function taking a CommandData item of type T and returning true if it should be included in the list. The class filtering is applied before the predicate.

### Exceptions

`IllegalArgumentException` - if no items, or multiple items matched the requirements.

Return
the Command item with CommandData values matching the predicate and clazz restrictions.

`inline fun <reified T : CommandData> findCommand(crossinline predicate: (T) -> Boolean): Command<T>`