corda / net.corda.finance.contracts.utils / kotlin.collections.Iterable

Extensions for kotlin.collections.Iterable

sumCash

Sums the cash states in the list, throwing an exception if there are none, or if any of the cash states cannot be added together (i.e. are different currencies or issuers).

fun Iterable<ContractState>.sumCash(): Amount<Issued<Currency>>

sumCashBy

Sums the cash states in the list belonging to a single owner, throwing an exception if there are none, or if any of the cash states cannot be added together (i.e. are different currencies or issuers).

fun Iterable<ContractState>.sumCashBy(owner: AbstractParty): Amount<Issued<Currency>>

sumCashOrNull

Sums the cash states in the list, returning null if there are none.

fun Iterable<ContractState>.sumCashOrNull(): Amount<Issued<Currency>>?

sumCashOrZero

Sums the cash states in the list, returning zero of the given currency+issuer if there are none.

fun Iterable<ContractState>.sumCashOrZero(currency: Issued<Currency>): Amount<Issued<Currency>>

sumFungibleOrNull

Sums the asset states in the list, returning null if there are none.

fun <T : Any> Iterable<ContractState>.sumFungibleOrNull(): Amount<Issued<T>>?

sumFungibleOrZero

Sums the asset states in the list, returning zero of the given token if there are none.

fun <T : Any> Iterable<ContractState>.sumFungibleOrZero(token: Issued<T>): Amount<Issued<T>>

sumObligations

Sums the obligation states in the list, throwing an exception if there are none. All state objects in the list are presumed to be nettable.

fun <P : Any> Iterable<ContractState>.sumObligations(): Amount<Issued<Terms<P>>>

sumObligationsOrNull

Sums the obligation states in the list, returning null if there are none.

fun <P : Any> Iterable<ContractState>.sumObligationsOrNull(): Amount<Issued<Terms<P>>>?

sumObligationsOrZero

Sums the obligation states in the list, returning zero of the given product if there are none.

fun <P : Any> Iterable<ContractState>.sumObligationsOrZero(issuanceDef: Issued<Terms<P>>): Amount<Issued<Terms<P>>>