LedgerTransaction.findReferenceInputRef - corda

corda / net.corda.core.transactions / LedgerTransaction / findReferenceInputRef

# findReferenceInputRef

`fun <T : ContractState> findReferenceInputRef(clazz: Class<T>, predicate: Predicate<T>): StateAndRef<T>`

Helper to simplify finding a single reference input matching a Predicate.

### Parameters

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

`predicate` - A filtering function taking a state of type T and returning true if this is the desired item. The class filtering is applied before the predicate.

### Exceptions

`IllegalArgumentException` - if no item, or multiple items are found matching the requirements.

Return
the single item matching the predicate.

`inline fun <reified T : ContractState> findReferenceInputRef(crossinline predicate: (T) -> Boolean): StateAndRef<T>`