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

Extensions for kotlin.collections.Iterable

sumCash

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

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).

sumCashBy

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

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).

sumCashOrNull

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

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

sumCashOrZero

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

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

sumFungibleOrNull

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

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

sumFungibleOrZero

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

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

sumObligations

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

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.

sumObligationsOrNull

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

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

sumObligationsOrZero

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

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